Name
lockfile
Synopsis
lockfile [options]filenames
Creates semaphore file(s), used to limit access to a file. When
lockfile fails to create some of the specified
files, it pauses for eight seconds and retries the last one on which
it failed. The command processes flags as they are encountered (i.e.,
a flag that is specified after a file won’t affect
that file).
Options
-
-sleeptime Time
lockfilewaits before retrying after a failed creation attempt. Default is eight seconds.-
-! Invert return value. Useful in shell scripts.
-
-llockout_time Time (in seconds) after a lockfile was last modified at which it will be removed by force. See also
-s.-
-ml,-mu If the permissions on the system mail spool directory allow it or if
lockfileis suitably setgid, it can lock and unlock your system mailbox with the options-mland-mu, respectively.-
-rretries Stop trying to create
filesafterretriesretries. The default is -1 (never stop trying). When giving up, remove all created files.-
-ssuspend_time After a lockfile has been removed by force (see
-l), a suspension of 16 seconds takes place by default. (This is intended to prevent the inadvertent immediate removal of any lockfile newly created by another program.) Use-sto change the default 16 seconds.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access