From bea59fd78e94912d121c76a02e90769f618d5b69 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 8 Oct 2015 20:54:37 +0200 Subject: [PATCH] library/roles/redmine/files/redmine.init: create the PID directory with the right owner if it does not exist. --- redmine/files/redmine.init | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/redmine/files/redmine.init b/redmine/files/redmine.init index 7e5f4841..ea0df4bc 100644 --- a/redmine/files/redmine.init +++ b/redmine/files/redmine.init @@ -15,7 +15,8 @@ DAEMON=unicorn DAEMON_OPTS="-c $APP/config/unicorn.rb -E production -D" NAME=unicorn DESC="Unicorn app for $USER" -PID=/run/unicorn/unicorn.pid +PID_DIR=/run/unicorn +PID=${PID_DIR}/unicorn.pid if [ -f /etc/default/unicorn-redmine ] ; then . /etc/default/unicorn-redmine @@ -26,6 +27,8 @@ case "$1" in CD_TO_APP_DIR="cd $APP" START_DAEMON_PROCESS="bundle exec $DAEMON $DAEMON_OPTS" + mkdir -p ${PID_DIR} + chown ${USER}:${USER} ${PID_DIR} echo -n "Starting $DESC: " if [ `whoami` = root ]; then su - $USER -c "$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS"