From 7f78f36d6abfbd563c3dda8e601b6fc7a0652e4f Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Mon, 3 Jun 2024 19:55:13 +0200 Subject: [PATCH] Fix jobrunner.log overwriting --- bash/jobrunner/daemon.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bash/jobrunner/daemon.sh b/bash/jobrunner/daemon.sh index 92c1b30d..cb3801d5 100755 --- a/bash/jobrunner/daemon.sh +++ b/bash/jobrunner/daemon.sh @@ -1,6 +1,14 @@ #!/bin/bash # jeremystartm's jobrunner +# Check for PID file +if [ -f "/tmp/jobrunner/jobrunner.pid" ]; then + echo ":: Error: The jobrunner daemon is already running." + echo " If you think that this is an error, remove" + echo " \"/tmp/jobrunner/jobrunner.pid\"." + exit 1 +fi + # Logging functions function log() { [[ -z "${JOBRUNNER_DISABLEOUTPUT}" ]] && echo "${*}" @@ -21,18 +29,10 @@ else echo ":: Creating runtime directory" mkdir -p "/tmp/jobrunner/" - echo -e "" > /tmp/jobrunner/jobrunner.log + echo -n "" > /tmp/jobrunner/jobrunner.log rm -rf /tmp/jobrunner/jobrunner.cmd fi -# Check for PID file -if [ -f "/tmp/jobrunner/jobrunner.pid" ]; then - log ":: Error: The jobrunner daemon is already running." - log " If you think that this is an error, remove" - log " \"/tmp/jobrunner/jobrunner.pid\"." - exit 1 -fi - # Write PID file log ":: Writing PID" echo "$$" > "/tmp/jobrunner/jobrunner.pid"