.TH setlock 8 .SH NAME setlock \- runs another program with a file locked. .SH SYNOPSIS .B setlock [ .B \-nNxX ] .I fn .I child .SH DESCRIPTION .I fn is a single argument. .I child consists of one or more arguments. .B setlock opens .I fn for writing (creating it if it does not exist), obtains an exclusive lock on it, and runs .IR child . Normally the lock disappears when .I child exits. Here's the complete story: .I child is given a descriptor for a locked ofile pointing to the disk file named .IR fn . The lock disappears when this ofile is .IP o closed by all the processes that have descriptors for it or .IP o explicitly unlocked. .SH OPTIONS .TP .B \-n No delay. If .I fn is locked by another process, .B setlock gives up. .TP .B \-N (Default.) Delay. If .I fn is locked by another process, .B setlock waits until it can obtain a new lock. .TP .B \-x If .I fn cannot be opened (or created) or locked, .B setlock exits zero. .TP .B \-X (Default.) If .I fn cannot be opened (or created) or locked, .B setlock prints an error message and exits nonzero. .SH SEE ALSO supervise(8), svc(8), svok(8), svstat(8), svscanboot(8), svscan(8), readproctitle(8), fghack(8), pgrphack(8), multilog(8), tai64n(8), tai64nlocal(8), setuidgid(8), envuidgid(8), envdir(8), softlimit(8) http://cr.yp.to/daemontools.html