mkmap.sh: Add locking around script call

rewrite
Jan-Philipp Litza 2014-07-06 20:07:49 +02:00
parent ee51547664
commit 54402ce089
1 changed files with 21 additions and 1 deletions

View File

@ -3,10 +3,30 @@
set -e
DEST=$1
LOCKFILE="/run/lock/ffmap"
[ "$DEST" ] || exit 1
cd "$(dirname "$0")"/
if lockfile-check "$LOCKFILE"; then
exit
fi
lockfile-create "$LOCKFILE"
lockfile-touch "$LOCKFILE" &
LOCKPID="$!"
./bat2nodes.py -A -a aliases.json -d $DEST
kill "$LOCKPID"
lockfile-remove "$LOCKFILE"
if lockfile-check "$LOCKFILE-sync"; then
exit
fi
lockfile-create "$LOCKFILE-sync"
lockfile-touch "$LOCKFILE-sync" &
LOCKPID="$!"
kill "$LOCKPID"
lockfile-remove "$LOCKFILE-sync"