#! /bin/bash . /etc/rc.conf . /etc/rc.d/functions case "$1" in start) stat_busy "Starting PHP-FPM Daemon" /usr/sbin/php-fpm &>/dev/null if [ $? -gt 0 ]; then stat_fail else add_daemon php-fpm stat_done fi ;; stop) stat_busy "Stoping PHP-FPM Daemon" kill -TERM `cat /var/run/php-fpm.pid` &>/dev/null if [ $? -gt 0 ]; then stat_fail else rm_daemon php-fpm stat_done fi ;; quit) stat_busy "Gracefully shutting down PHP-FPM Daemon" kill -QUIT `cat /var/run/php-fpm.pid` &>/dev/null if [ $? -gt 0 ]; then stat_fail else rm_daemon php-fpm stat_done fi ;; restart) $0 stop sleep 3 $0 start ;; reload) if [ -f /var/run/php-fpm.pid ]; then status "Reloading PHP-FPM configuration" kill -USR2 `cat /var/run/php-fpm.pid` fi ;; logrotate) if [ -f /var/run/php-fpm.pid ]; then status "Reopening PHP-FPM log file" kill -USR1 `cat /var/run/php-fpm.pid` fi ;; *) echo "usage: $0 {start|stop|quit|restart|reload|logrotate}" ;; esac