Blame SOURCES/php-fpm.init

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