root/bin/lockfile @ 7303
1 | 7259 | aaronmk | #!/bin/sh
|
---|---|---|---|
2 | # Wraps lockfile/dotlockfile
|
||
3 | 7260 | aaronmk | # Usage: env [interval=...] self lockfile
|
4 | 7259 | aaronmk | |
5 | 7262 | aaronmk | : "${interval=5}" # s |
6 | 7260 | aaronmk | |
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
|