root/bin/lockfile @ 7427
1 |
#!/bin/sh
|
---|---|
2 |
# Wraps lockfile/dotlockfile
|
3 |
# Usage: env [interval=...] self lockfile
|
4 |
|
5 |
selfDir="$(dirname -- "$0")" |
6 |
|
7 |
: "${interval=5}" # s |
8 |
|
9 |
if test "$(uname)" = Darwin; then |
10 |
while ! shlock -p "$PPID" -f "$1"; do sleep "$interval"; done |
11 |
else
|
12 |
exec "$selfDir/dotlockfile" -l -r 2147483647 -p "$1" # exec to inherit PPID |
13 |
fi
|