Skip to content
Snippets Groups Projects
Commit d72a52a4 authored by Timothe Jost's avatar Timothe Jost
Browse files

cronjob rename

parent 6827b801
Branches
No related tags found
No related merge requests found
...@@ -19,21 +19,22 @@ start_task() { ...@@ -19,21 +19,22 @@ start_task() {
echo $! > "$PIDFILE" echo $! > "$PIDFILE"
} }
# Check if the PID file exists # # Check if the PID file exists
if [ -f "$PIDFILE" ]; then # if [ -f "$PIDFILE" ]; then
PID=$(cat "$PIDFILE") # PID=$(cat "$PIDFILE")
# Check if the process is running # # Check if the process is running
if ps -p $PID > /dev/null; then # if ps -p $PID > /dev/null; then
echo "Task is already running with PID $PID" >> "$LOGFILE" # echo "Task is already running with PID $PID" >> "$LOGFILE"
exit 0 # exit 0
else # else
echo "Task is not running, but PID file exists. Cleaning up..." >> "$LOGFILE" # echo "Task is not running, but PID file exists. Cleaning up..." >> "$LOGFILE"
rm -f "$PIDFILE" # rm -f "$PIDFILE"
fi # fi
fi # fi
# Start the task # # Start the task
start_task # start_task
# sleep 10
# Monitor the task and restart if it crashes # Monitor the task and restart if it crashes
while true; do while true; do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment