diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-06-27 14:53:46 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-07-15 16:30:59 +0100 |
commit | 8ad2e5f6d54ff07173e8363d35386c2843a05826 (patch) | |
tree | 223bdff0f81617917c9f5831cbd35006cf0b323f | |
parent | ada1aeee86ced562a72f3be4bace65ba493cfdaf (diff) |
Ensure the log and pid directories exist
If the directories do not exist the daemon cannot start.
-rwxr-xr-x | config/alert-tracks-debian.ugly | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/config/alert-tracks-debian.ugly b/config/alert-tracks-debian.ugly index e79a0cec6..f1ca68b03 100755 --- a/config/alert-tracks-debian.ugly +++ b/config/alert-tracks-debian.ugly @@ -15,8 +15,10 @@ NAME=!!(*= $daemon_name *)!! DAEMON=!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/runner DAEMON_ARGS="--daemon TrackMailer.alert_tracks_loop" -PIDFILE=!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/tmp/pids/!!(*= $daemon_name *)!!.pid -LOGFILE=!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/log/!!(*= $daemon_name *)!!.log +PIDDIR=!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/tmp/pids +PIDFILE=$PIDDIR/!!(*= $daemon_name *)!!.pid +LOGDIR=!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/log +LOGFILE=$LOGDIR/!!(*= $daemon_name *)!!.log DUSER=!!(*= $user *)!! # Set RAILS_ENV - not needed if using config/rails_env.rb # RAILS_ENV=your_rails_env @@ -27,10 +29,14 @@ trap "" 1 export PIDFILE LOGFILE quietly_start_daemon() { + mkdir -p {$LOGDIR,$PIDDIR} + chown $DUSER:$DUSER {$LOGDIR,$PIDDIR} /sbin/start-stop-daemon --quiet --start --pidfile "$PIDFILE" --chuid "$DUSER" --startas "$DAEMON" -- $DAEMON_ARGS } start_daemon() { + mkdir -p {$LOGDIR,$PIDDIR} + chown $DUSER:$DUSER {$LOGDIR,$PIDDIR} /sbin/start-stop-daemon --start --pidfile "$PIDFILE" --chuid "$DUSER" --startas "$DAEMON" -- $DAEMON_ARGS } |