library/roles/redmine/files/redmine.init: create the PID directory with the right owner if it does not exist.

This commit is contained in:
Andrea Dell'Amico 2015-10-08 20:54:37 +02:00
parent 8f06502470
commit bea59fd78e
1 changed files with 4 additions and 1 deletions

View File

@ -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"