3 # @processname@ PHP FastCGI Process Manager
7 # description: PHP FastCGI Process Manager
9 # processname: @processname@
10 # config: /etc/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/fpm.conf
21 lockfile=/var/lock/subsys/@processname@
22 pidfile=$(sed -ne 's,.*"\?pid_file"\?>\([^<]\+\)<.*,\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 (@processname@)"
32 msg_starting "PHP FastCGI Process Manager (@processname@)"
33 daemon --pidfile $pidfile /usr/sbin/@processname@ --fpm --fpm-config $configfile
35 [ $RETVAL -eq 0 ] && touch $lockfile
39 if [ ! -f $lockfile ]; then
40 msg_not_running "PHP FastCGI Process Manager (@processname@)"
45 msg_stopping "PHP FastCGI Process Manager (@processname@)"
46 # always gracefully shut down @processname@
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 (@processname@)"
61 msg_reloading "PHP FastCGI Process Manager (@processname@)"
62 killproc --pidfile $pidfile @processname@ -$sig
67 if [ ! -f $lockfile ]; then
68 msg_not_running "PHP FastCGI Process Manager (@processname@)"
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}"