diff --git a/cronjob.sh b/cronjob.sh index e79323b96fbd4bd01f4ea826e201a50ce0a557a7..3105126eb4267b4573a63389b805b829bbf7e246 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