diff --git a/mkmap.sh b/mkmap.sh index 1c6453f..28195be 100755 --- a/mkmap.sh +++ b/mkmap.sh @@ -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"