summaryrefslogtreecommitdiffstats
path: root/flock.1
diff options
context:
space:
mode:
Diffstat (limited to 'flock.1')
-rw-r--r--flock.128
1 files changed, 24 insertions, 4 deletions
diff --git a/flock.1 b/flock.1
index 8b0d600..8c71ff6 100644
--- a/flock.1
+++ b/flock.1
@@ -29,13 +29,24 @@
.SH NAME
flock \- Manage locks from shell scripts
.SH SYNOPSIS
-\fBflock\fP [\fIOPTIONS\fR] FD
+\fBflock\fP [\fB\-sxon\fP] [\fB\-w\fP \fItimeout\fP] \fIlockfile\fP [\fB\-c\fP] \fIcommand...\fP
+.PP
+\fBflock\fP [\fB\-sxun\fP] [\fB\-w\fP \fItimeout\fP] \fIfd\fP
.SH DESCRIPTION
.PP
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.
+.PP
+The first form wraps the lock around the executing a command, in a manner similar to
+.BR su (1)
+or
+.BR newgrp (1).
+It locks a specified file, which is created (assuming appropriate
+permissions), if it does not already exist.
+.PP
+The second form is conveninent inside shell scripts, and is usually
+used the following manner:
.PP
\fC(
.br
@@ -73,12 +84,21 @@ lock.
Fail (with an exit code of 1) rather than wait if the lock cannot be
immediately acquired.
.TP
+\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.
+.TP
+\fB\-o\fP, \fB\-\-close\fP
+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.
+.TP
\fB\-h\fP, \fB\-\-help\fP
Print a help message.
.SH AUTHOR
Written by H. Peter Anvin <hpa@zytor.com>.
.SH COPYRIGHT
-Copyright \(co 2003 H. Peter Anvin.
+Copyright \(co 2003\-2005 H. Peter Anvin.
.br
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.