From ccf8bd987b7bfeac4a207d2576511061accafb8e Mon Sep 17 00:00:00 2001 From: Timothe Jost <timothe.jost@wanadoo.fr> Date: Thu, 4 Jul 2024 13:54:56 +0200 Subject: [PATCH] better cronjob.sh --- cronjob.sh | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/cronjob.sh b/cronjob.sh index e79323b..3105126 100644 --- a/cronjob.sh +++ b/cronjob.sh @@ -21,23 +21,6 @@ start_task() { echo $! > "$PIDFILE" } -# # Check if the PID file exists -# if [ -f "$PIDFILE" ]; then -# PID=$(cat "$PIDFILE") -# # Check if the process is running -# if ps -p $PID > /dev/null; then -# echo "Task is already running with PID $PID" >> "$LOGFILE" -# exit 0 -# else -# echo "Task is not running, but PID file exists. Cleaning up..." >> "$LOGFILE" -# rm -f "$PIDFILE" -# fi -# fi - -# # Start the task -# start_task -# sleep 10 - # Monitor the task and restart if it crashes while true; do PID=$(cat "$PIDFILE") @@ -45,5 +28,6 @@ while true; do echo "Task crashed. Restarting..." >> "$LOGFILE" start_task fi + echo "Restarting task in $SLEEP_TIME seconds..." >> "$LOGFILE" sleep $SLEEP_TIME done \ No newline at end of file -- GitLab