Project

General

Profile

« Previous | Next » 

Revision 23a4a9f6

Added by Mikael Fridh over 12 years ago

  • ID 23a4a9f66c21237d962e4dfdafb5797bd536bd93

fixes #1472 - make init script passenger-aware (redhat)

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

Also available in: Unified diff