Blame SOURCES/php-fpm.init

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