From 71fe742fc335aa7e6fae29a81ee8676cbe0a59f8 Mon Sep 17 00:00:00 2001 From: Alper Kanat Date: Mon, 3 Nov 2008 23:44:20 +0000 Subject: [PATCH] added lock file support to the sync script.. --- sync | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sync b/sync index 545cf41..f3dd186 100755 --- a/sync +++ b/sync @@ -2,5 +2,16 @@ # sync.sh # # this script is written to syncronize the lkd planet.. +# +# author: Alper KANAT -./planet.py gezegen/config.ini &> logs/planet-$(date +"%d.%m.%Y-%H:%M").log & +PLANET_DIR="${HOME}/public_html/gezegen" +LOCK_FILE="planet-sync.lck" + +if [[ -f "$PLANET_DIR/$LOCK_FILE" ]]; then + echo "there's a sync process running behind, please try again later.." &> logs/planet-$(date +"%d.%m.%Y-%H:%M").log & + exit 1 +else + ./planet.py gezegen/config.ini &> logs/planet-$(date +"%d.%m.%Y-%H:%M").log & + touch "$PLANET_DIR/$LOCK_FILE" +fi