Fix jobrunner.log overwriting
This commit is contained in:
parent
61c3e1c903
commit
7f78f36d6a
1 changed files with 9 additions and 9 deletions
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue