Diffstat (limited to 'flock.1')
1 files changed, 24 insertions, 4 deletions
@@ -29,13 +29,24 @@
flock \- Manage locks from shell scripts
-\fBflock\fP [\fIOPTIONS\fR] FD
+\fBflock\fP [\fB\-sxon\fP] [\fB\-w\fP \fItimeout\fP] \fIlockfile\fP [\fB\-c\fP] \fIcommand...\fP
+\fBflock\fP [\fB\-sxun\fP] [\fB\-w\fP \fItimeout\fP] \fIfd\fP
This utility manages
.BR flock (2)
-locks from within shell scripts. It is usually used in something
-similar to the following manner:
+locks from within shell scripts or the command line.
+The first form wraps the lock around the executing a command, in a manner similar to
+.BR su (1)
+.BR newgrp (1).
+It locks a specified file, which is created (assuming appropriate
+permissions), if it does not already exist.
+The second form is conveninent inside shell scripts, and is usually
+used the following manner:
@@ -73,12 +84,21 @@ lock.
Fail (with an exit code of 1) rather than wait if the lock cannot be
+\fB\-w\fP, \fB\-\-timeout\fP \fIseconds\fP
+Fail (with an exit code of 1) if the lock cannot be acquired within
+\fIseconds\fP seconds. Decimal fractional values are allowed.
+Close the file descriptor on which the lock is held before executing
+\fIcommand\fP. This is useful if \fIcommand\fP spawns a child process
+which should not be hold ing the lock.
Print a help message.
Written by H. Peter Anvin <email@example.com>.
-Copyright \(co 2003 H. Peter Anvin.
+Copyright \(co 2003\-2005 H. Peter Anvin.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.