3 # php-fpm PHP FastCGI Process Manager
7 # description: PHP FastCGI Process Manager
10 # config: /etc/php/php-fpm.conf
11 # pidfile: /var/run/@processname@.pid
14 # Source function library
15 . /etc/rc.d/init.d/functions
18 . /etc/sysconfig/network
20 configfile=/etc/php/php-fpm.conf
21 lockfile=/var/lock/subsys/@processname@
22 pidfile=$(sed -ne 's,^pid\s*=\s*\(.*\),\1,p' $configfile)
23 pidfile=${pidfile:-/var/run/@processname@.pid}
26 # Check if the service is already running?
27 if [ -f $lockfile ]; then
28 msg_already_running "PHP FastCGI Process Manager"
32 msg_starting "PHP FastCGI Process Manager (@processname@)"
33 daemon --pidfile $pidfile /usr/sbin/@processname@ --fpm-config $configfile
35 [ $RETVAL -eq 0 ] && touch $lockfile
39 if [ ! -f $lockfile ]; then
40 msg_not_running "PHP FastCGI Process Manager"
45 msg_stopping "PHP FastCGI Process Manager"
46 # always gracefully shut down php-fpm
47 /sbin/start-stop-daemon -q --stop -s QUIT --retry QUIT/600/TERM/10 --pidfile $pidfile
48 [ "$?" -eq 0 ] && ok || fail
55 if [ ! -f $lockfile ]; then
56 msg_not_running "PHP FastCGI Process Manager"
61 msg_reloading "PHP FastCGI Process Manager"
62 killproc --pidfile $pidfile php-fpm -$sig
67 if [ ! -f $lockfile ]; then
68 msg_not_running "PHP FastCGI Process Manager"
78 # See how we were called.
100 status --pidfile $pidfile @processname@
104 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|flush-logs|status}"