Blame SOURCES/php-fpm.init

de2dbd
#! /bin/sh
de2dbd
#
de2dbd
# chkconfig: - 84 16
de2dbd
# description:	PHP FastCGI Process Manager
de2dbd
# processname: php-fpm
de2dbd
# config: /etc/php-fpm.conf
de2dbd
# config: /etc/sysconfig/php-fpm
de2dbd
# pidfile: /var/run/php-fpm/php-fpm.pid
de2dbd
#
de2dbd
### BEGIN INIT INFO
de2dbd
# Provides: php-fpm
de2dbd
# Required-Start: $local_fs $remote_fs $network $named
de2dbd
# Required-Stop: $local_fs $remote_fs $network
de2dbd
# Short-Description: start and stop PHP FPM
de2dbd
# Description: PHP FastCGI Process Manager
de2dbd
### END INIT INFO
de2dbd
de2dbd
# Standard LSB functions
de2dbd
#. /lib/lsb/init-functions
de2dbd
de2dbd
# Source function library.
de2dbd
. /etc/init.d/functions
de2dbd
de2dbd
# Check that networking is up.
de2dbd
. /etc/sysconfig/network
de2dbd
de2dbd
# Additional environment file
de2dbd
if [ -f /etc/sysconfig/php-fpm ]; then
de2dbd
      . /etc/sysconfig/php-fpm
de2dbd
fi
de2dbd
de2dbd
if [ "$NETWORKING" = "no" ]
de2dbd
then
de2dbd
	exit 0
de2dbd
fi
de2dbd
de2dbd
RETVAL=0
de2dbd
prog="php-fpm"
de2dbd
pidfile=${PIDFILE-/var/run/php-fpm/php-fpm.pid}
de2dbd
lockfile=${LOCKFILE-/var/lock/subsys/php-fpm}
de2dbd
de2dbd
start () {
de2dbd
	echo -n $"Starting $prog: "
de2dbd
	dir=$(dirname ${pidfile})
de2dbd
	[ -d $dir ] || mkdir $dir
de2dbd
	daemon --pidfile ${pidfile} /usr/sbin/php-fpm --daemonize
de2dbd
	RETVAL=$?
de2dbd
	echo
de2dbd
	[ $RETVAL -eq 0 ] && touch ${lockfile}
de2dbd
}
de2dbd
stop () {
de2dbd
	echo -n $"Stopping $prog: "
de2dbd
	killproc -p ${pidfile} php-fpm
de2dbd
	RETVAL=$?
de2dbd
	echo
de2dbd
	if [ $RETVAL -eq 0 ] ; then
de2dbd
		rm -f ${lockfile} ${pidfile}
de2dbd
	fi
de2dbd
}
de2dbd
de2dbd
restart () {
de2dbd
        stop
de2dbd
        start
de2dbd
}
de2dbd
de2dbd
reload () {
de2dbd
	echo -n $"Reloading $prog: "
de2dbd
	if ! /usr/sbin/php-fpm --test ; then
de2dbd
	        RETVAL=6
de2dbd
	        echo $"not reloading due to configuration syntax error"
de2dbd
	        failure $"not reloading $prog due to configuration syntax error"
de2dbd
	else
de2dbd
		killproc -p ${pidfile} php-fpm -USR2
de2dbd
		RETVAL=$?
de2dbd
	fi
de2dbd
	echo
de2dbd
}
de2dbd
de2dbd
de2dbd
# See how we were called.
de2dbd
case "$1" in
de2dbd
  start)
de2dbd
	start
de2dbd
	;;
de2dbd
  stop)
de2dbd
	stop
de2dbd
	;;
de2dbd
  status)
de2dbd
	status -p ${pidfile} php-fpm
de2dbd
	RETVAL=$?
de2dbd
	;;
de2dbd
  restart)
de2dbd
	restart
de2dbd
	;;
de2dbd
  reload|force-reload)
de2dbd
	reload
de2dbd
	;;
de2dbd
  configtest)
de2dbd
 	/usr/sbin/php-fpm --test
de2dbd
	RETVAL=$?
de2dbd
	;;
de2dbd
  condrestart|try-restart)
de2dbd
	[ -f ${lockfile} ] && restart || :
de2dbd
	;;
de2dbd
  *)
de2dbd
	echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|try-restart|configtest}"
de2dbd
	RETVAL=2
de2dbd
        ;;
de2dbd
esac
de2dbd
de2dbd
exit $RETVAL