Update distributed_cron.sh

This commit is contained in:
holzi1005 2024-11-17 10:06:16 +01:00
parent 15912e2aed
commit c746c208ee

View file

@ -5,7 +5,7 @@
# Usage: Use the helper script in cronjobs in hosts or containers. # Usage: Use the helper script in cronjobs in hosts or containers.
# The cron_lock can be shared so the job will only be executed one. # The cron_lock can be shared so the job will only be executed one.
TIME=$(shuf -i 0-800 -n1) TIME=$(shuf -i 0-900 -n1)
sleep 0.$TIME sleep 0.$TIME
echo "Sleep for 0.$TIME" echo "Sleep for 0.$TIME"
@ -27,12 +27,10 @@ then
fi fi
echo "Job done. Keep lock for 20 seconds" echo "Job done. Keep lock for 20 seconds"
sleep 10
rm $FILE
exit 0
else else
echo "Other Server is running cron job" echo "Other Server is running cron job"
sleep 30
rm $FILE
exit 0 exit 0
fi fi
sleep 10
rm $FILE