setlock
1
user commands
djbwares
setlock
runs another program with a file locked.
setlock
-n
-N
-x
-X
fn
child
Description
fn is a single argument.
child consists of one or more arguments.
setlock opens fn for writing (creating it if it does not exist), obtains an exclusive lock on it, and runs child.
Normally the lock disappears when child exits.
Here's the complete story:
child is given a descriptor for a locked ofile pointing to the disk file named fn.
The lock disappears when this ofile is
either closed by all the processes that have descriptors for it
or explicitly unlocked.
Options
-n
No delay.
If fn is locked by another process, setlock gives up.
-N
(Default.)
Delay.
If fn is locked by another process, setlock waits until it can obtain a new lock.
-x
If fn cannot be opened (or created) or locked, setlock exits zero.
-X
(Default.)
If fn cannot be opened (or created) or locked, setlock prints an error message and exits nonzero.
See also
supervise1
svc1
svok1
svstat1
svscanboot1
svscan1
readproctitle1
fghack1
pgrphack1
multilog1
tai64n1
tai64nlocal1
setuidgid1
envuidgid1
envdir1
softlimit1
Author
Original code and documentation by Daniel J. Bernstein.
Converted to manual pages and updated by GerritPape in 2000, 2001, and 2002.
Converted to DocBook XML by Jonathan de Boyne Pollard.