diff --git a/redmine/files/redmine.init b/redmine/files/redmine.init index 7e5f484..ea0df4b 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"