Use flock for locking instead of hand-crafted mechanism
authorPeter Eisentraut <peter_e@gmx.net>
Tue, 7 Feb 2012 20:13:15 +0000 (20:13 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Tue, 7 Feb 2012 20:13:15 +0000 (20:13 +0000)
wwwtools/update-nls-www

index 8b46b37441858ef00267ec5fa561d970a1e355bc..354d6a2dca398c0ab447aea24a920df412fad6c6 100755 (executable)
@@ -25,10 +25,8 @@ if [ -n "$1" ]; then
        force=true
 fi
 
-lock="$PWD/lock"
-test -e "$lock" && exit 77
-trap 'rm -f $tmp $lock' EXIT ERR SIGHUP SIGINT SIGPIPE SIGTERM
-touch "$lock"
+(
+flock -n 9 || exit 0
 
 for branch in $active_branches; do
        tmp=`mktemp /tmp/$me.XXXXXX`
@@ -78,3 +76,5 @@ for branch in $active_branches; do
 done
 
 date -u +%FT%T
+
+) 9>"$PWD/lock"