dotlockfile − Utility to manage lockfiles
/usr/bin/dotlockfile [−l [−r retries] |−u|−t|−c] [−p] [−m|lockfile]
dotlockfile is a command line utility to reliably create, test and remove lockfiles. It creates lockfiles
reliably on local and NFS filesystems, because the crucial steps of testing for a preexisting lockfile and
creating it are performed atomically by a single call to link(2). Manpage lockfile_create(3) describes the
dotlockfile is installed with attribute SETGID mail and thus can also be used to lock and unlock mailboxes
even if the mailspool directory is only writable by group mail.
The name dotlockfile comes from the way mailboxes are locked for updates on a lot of UNIX systems. A
lockfile is created with the same filename as the mailbox but with the string ".lock" appended.
The names dotlock and lockfile were already taken − hence the name dotlockfile :).
Create a lockfile if no preexisting valid lockfile is found, else wait and retry according to option
−r. This option is the default.
A lockfile is treated as valid,
• if it holds the process−id of a running process,
• or if it does not hold any process−id and has been touched less than 5 minutes ago (timestamp
is younger than 5 minutes).
The number of times dotlockfile retries to acquire the lock if it failed the first time before giving
up. The initial sleep after failing to acquire the lock is 5 seconds. After each retry the sleep
intervall is increased incrementally by 5 seconds up to a maximum sleep of 60 seconds between
tries. The default number of retries is 5. To try only once, use "−r 0".
Remove a lockfile.
Touch an existing lockfile (update the timestamp). Useful for lockfiles on NFS filesystems. For
lockfiles on local filesystems the −p option is preferable.
For debugging only: Check for the existence of a valid lockfile.
Note: Testing for a preexisting lockfile and writing of the lockfile must be done by the same