Project

General

Profile

Feature #1472 ยป 0001-fixes-1472-make-init-script-passenger-aware-redhat.patch

Mikael Fridh, 01/26/2012 09:11 AM

View differences:

extras/spec/foreman.init
FOREMAN_HOME=${FOREMAN_HOME:-/usr/share/foreman}
FOREMAN_ENV=${FOREMAN_ENV:-production}
FOREMAN_PID=${FOREMAN_PID:-${FOREMAN_HOME}/tmp/pids/server.pid}
FOREMAN_USE_PASSENGER=${FOREMAN_USE_PASSENGER:-0}
start() {
echo -n $"Starting $prog: "
......
return $RETVAL
}
railsrestart() {
echo -n $"Restarting foreman rails app: "
touch "${FOREMAN_HOME}/tmp/restart.txt"
RETVAL=$?
if [ $RETVAL = 0 ]
then
echo_success
else
echo_failure
fi
echo
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
start|stop)
if [ ${FOREMAN_USE_PASSENGER} = 1 ]
then
echo -n "Foreman is running under passenger"
echo_passed
echo
else
$1
fi
RETVAL=$?
;;
stop)
stop
restart)
if [ ${FOREMAN_USE_PASSENGER} = 1 ]
then
railsrestart
RETVAL=$?
else
stop
start
RETVAL?$?
fi
;;
status)
echo -n "Foreman"
status -p $FOREMAN_PID
if [ ${FOREMAN_USE_PASSENGER} = 1 ]
then
echo -n " is running under passenger"
echo_passed
echo
else
status -p $FOREMAN_PID
fi
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f ${FOREMAN_HOME}/tmp/pids/server.pid ]; then
stop
start
restart
RETVAL=$?
fi
;;
extras/spec/foreman.sysconfig
# the rails environment in which foreman runs
#FOREMAN_ENV=production
# if we're using passenger or not
# if set to 1, init script will do a railsrestart on 'restart' and will refuse
# 'start' and 'stop' completely and remind the operator that passenger is in
# use.
#FOREMAN_USE_PASSENGER=0
    (1-1/1)