Blame SOURCES/php-fpm.init

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