lockfile-progs(1)
π lockfile-progs π
okay bestie, welcome to lockfile-progs β aka the Lockfile programs, the little command-line crew that locks and unlocks your files and mailboxes safely (via liblockfile). no cap, this is the whole vibe. π
β¨ NAME β¨
lockfile-progs β command-line programs to safely lock and unlock files and mailboxes (via liblockfile).
πΈ SYNOPSIS πΈ
mail-lock [--use-pid] [--retry retry-count]
mail-unlock
mail-touchlock [--oneshot]
lockfile-create [--use-pid] [--retry retry-count] [--lock-name] filename
lockfile-remove [--lock-name] filename
lockfile-touch [--oneshot] [--lock-name] filename
lockfile-check [--use-pid] [--lock-name] filename
π¦ DESCRIPTION π¦
so lockfile-progs hands you a whole set of programs that lock and unlock mailboxes and files safely (via liblockfile). it's giving "responsible friend who holds your keys." π
mail-lockβ lock the current user's mailboxmail-unlockβ unlock the current user's mailboxmail-touchlockβ touch the lock on the current user's mailboxlockfile-createβ lock a given filelockfile-removeβ remove the lock on a given filelockfile-touchβ touch the lock on a given filelockfile-checkβ check the lock on a given file
by default, the filename argument refers to the name of the file to be locked, and the name of the lockfile will be filename .lock. but β if the --lock-name argument is specified, then filename will be taken as the name of the lockfile itself. plot twist, but a cute one. π
each of the mail locking commands attempts to lock /var/spool/mail/<user>, where <user> is the name associated with the effective user ID, as determined by via geteuid(2).
once a file is locked, the lock must be touched at least once every five minutes or the lock will be considered stale, and subsequent lock attempts will succeed. lowkey important!! also see the --use-pid option and the lockfile_create(3) manpage.
the lockfile-check command tests whether or not a valid lock already exists. vibe check for locks, fr fr. β¨
π OPTIONS π
--versionβ report the version to standard output and exit. bye bestie π-q,--quietβ suppress any output. success or failure will only be indicated by the exit status. silent but iconic. π€«-v,--verboseβ enable diagnostic output. tell me everything, i'm obsessed. π-l,--lock-nameβ do not append.lockto the filename. this option applies tolockfile-create,lockfile-remove,lockfile-touch, orlockfile-check.-p,--use-pidβ write the parent process id (PPID) to the lockfile whenever a lockfile is created, and use that pid when checking a lock's validity. see thelockfile_create(3)manpage for more information. this option applies tolockfile-createandlockfile-check.
NOTE: this option will not work correctly between machines sharing a filesystem. π do not do the thing.
-o,--oneshotβ touch the lock and exit immediately. this option applies tolockfile-touchandmail-touchlock. when not provided, these commands will run forever, touching the lock once every minute until killed. main character energy that never leaves the party. π-rretry-count,--retryretry-count β try to lock filename retry-count times before giving up. each attempt will be delayed a bit longer than the last (in 5 second increments) until reaching a maximum delay of one minute between retries. if retry-count is unspecified, the default is9which will give up after225seconds if all 9 lock attempts fail.
π EXAMPLES π
locking a file during a lengthy process:
lockfile-create /some/file
lockfile-touch /some/file &
# Save the PID of the lockfile-touch process
BADGER="$!"
do-something-important-with /some/file
kill "${BADGER}"
lockfile-remove /some/file
the variable is literally named BADGER. we love to see it. π¦‘β¨
π EXIT STATUS π
0β forlockfile-checkthis indicates that a valid lock exists, otherwise it just indicates successful program execution. slay. π- Not
0β forlockfile-checka non-zero exit status indicates that the specified lock does not exist or is not valid. for other programs it indicates that some problem was encountered. not slay. π
π«Ά SEE ALSO π«Ά
maillock(3)touchlock(3)mailunlock(3)lockfile_create(3)lockfile_remove(3)lockfile_touch(3)lockfile_check(3)
π§ AUTHOR π§
written by Rob Browning <rlb@defaultvalue.org>
okay that's the whole page, bestie!! this one's version 0.2.0build1 and it was dated 2025-12-06 β iconic numbers, no notes. now go lock something safely and touch it every five minutes. mwah. πππ¦
π¦ where this page comes from
- ubuntu resolute: lockfile-progs 0.2.0build1 Β· GPL
- ubuntu stonking: lockfile-progs 0.2.0build1 Β· GPL
- Copyright (C) 1998-2008 2021 2024 Rob Browning <rlb@defaultvalue.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms