# Check if the service is already running?
if [ ! -f /var/lock/subsys/php-fpm ]; then
msg_starting "PHP FastCGI Process Manager"
- daemon /usr/bin/php.fpm --fpm --fpm-config /etc/php/fpm.conf
+ daemon --pidfile $pidfile /usr/bin/php.fpm --fpm --fpm-config /etc/php/fpm.conf
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/php-fpm
else
if [ -f /var/lock/subsys/php-fpm ]; then
# Stop daemons.
msg_stopping "PHP FastCGI Process Manager"
- killproc --pidfile $pidfile php-fpm -TERM
- rm -f /var/lock/subsys/php-fpm
- else
- msg_not_running "PHP FastCGI Process Manager"
- fi
-}
-
-# Gracefully shutting down php_fpm
-quit() {
- if [ -f /var/lock/subsys/php-fpm ]; then
- # Stop daemons.
- msg_stopping "PHP FastCGI Process Manager"
- killproc --pidfile $pidfile php-fpm -QUIT
+ # always gracefully shut down php-fpm
+ /sbin/start-stop-daemon -q --stop -s QUIT --retry QUIT/600/TERM/10 --pidfile $pidfile
+ [ "$?" -eq 0 ] && ok || fail
rm -f /var/lock/subsys/php-fpm
else
msg_not_running "PHP FastCGI Process Manager"
start)
start
;;
- stop)
+ stop|quit)
stop
;;
restart)
reload|force-reload)
reload USR2 7
;;
- quit) # graceful shutdown
- quit
- ;;
flush-logs|logrotate)
reload USR1 0
;;