run1 - Run a program once at a time
run1 [ -d
dir ] [ -l
label ] [ -w
sec ] [ -k
sec ]
program [ args ]
This program is useful for keeping multiple copies of a program from running concurrently.
-d
directory-l
label-w
seconds-k
seconds-s
run1 -s -l mirror run1 mirror-updates run1 -s -l mirror run1 mirror-dist run1 -l mirror mirror-all
Since mirror-updates and mirror-dist get a shared lock on ``mirror'', they'll keep mirror-all from running, but they'll run just fine individually. While mirror-all is running, neither mirror-updates or mirror-dist will run.
Note that currently -w and -k are ignored when using shared locks. (This may or may not change at some point in the future.)
Please note that this script will only work reliably when the lock
directory is on a filesystem (and operating system) where you can rely on
open(2) with O_EXCL
and flock(2) working properly. In other
words, don't point the lock directory to a network filesystem (especially
NFS). Use -d
/some/local/dir.
lockfile(1)
The limitations of the locking system (see NOTES above) could be construed as bugs.
Steven Pritchard <steve@silug.org>