Revision 7260
Added by Aaron Marcuse-Kubitza almost 12 years ago
lockfile | ||
---|---|---|
1 | 1 |
#!/bin/sh |
2 | 2 |
# Wraps lockfile/dotlockfile |
3 |
# Usage: self lockfile_opts...
|
|
3 |
# Usage: env [interval=...] self lockfile
|
|
4 | 4 |
|
5 |
exec "$(test "$(uname)" = Darwin && echo lockfile || echo dotlockfile)" "$@" |
|
5 |
: "${interval=60}" # s |
|
6 |
|
|
7 |
if test "$(uname)" = Darwin; then |
|
8 |
while ! shlock -p "$PPID" -f "$1"; do sleep "$interval"; done |
|
9 |
else |
|
10 |
exec dotlockfile -l -r -1 -p "$1" # need exec to inherit PPID |
|
11 |
fi |
Also available in: Unified diff
bin/lockfile: Include the PID in the lockfile to avoid the need to manually remove lockfiles. On Mac, this requires using shlock instead of lockfile.