diff --git a/conjob.sh b/cronjob.sh similarity index 60% rename from conjob.sh rename to cronjob.sh index 04582c5171543a899697cbccbed2eb5616d25293..bf29121f769e316e4ab1368c362718063a04b921 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