From c25a30d1a4566ec3a75aed7e22c81648103465ed Mon Sep 17 00:00:00 2001 From: holzi1005 Date: Sun, 17 Nov 2024 10:25:06 +0100 Subject: [PATCH] update removal log method --- distributed_cron.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/distributed_cron.sh b/distributed_cron.sh index 3c714c3..a073f63 100644 --- a/distributed_cron.sh +++ b/distributed_cron.sh @@ -15,7 +15,7 @@ FILE=$1 if [ ! -f $FILE ] then echo $(hostname) > $FILE - echo "Create cron_lock for server" + echo "$(date) -- START CRON_LOCK -- $(hostname)" >> $FILE.log $2 @@ -26,11 +26,14 @@ then echo "OK -- $(date) -- $(hostname)" >> $FILE.log fi - echo "Job done. Keep lock for 20 seconds" else echo "Other Server is running cron job" - exit 0 fi -sleep 10 -rm $FILE \ No newline at end of file +sleep 10.$TIME + +if [ -f $FILE ] +then + echo "$(date) -- REMOVE CRON_LOCK -- $(hostname)" >> $FILE.log + rm $FILE +fi