From d72a52a4a365ff8aa15b48d413e1d62a9d7d792f Mon Sep 17 00:00:00 2001 From: Timothe Jost <timothe.jost@wanadoo.fr> Date: Thu, 4 Jul 2024 13:48:44 +0200 Subject: [PATCH] cronjob rename --- conjob.sh => cronjob.sh | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) rename conjob.sh => cronjob.sh (60%) diff --git a/conjob.sh b/cronjob.sh similarity index 60% rename from conjob.sh rename to cronjob.sh index 04582c5..bf29121 100644 --- a/conjob.sh +++ b/cronjob.sh @@ -19,21 +19,22 @@ 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 +# # 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 -- GitLab