From a455353d3e21591879325e69dab98438b0a67d88 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 28 Jan 2014 17:50:23 +0100 Subject: improves php-fpm sysvinit script --- php-fpm.init | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'php-fpm.init') diff --git a/php-fpm.init b/php-fpm.init index 96826a3..63aac66 100755 --- a/php-fpm.init +++ b/php-fpm.init @@ -4,7 +4,16 @@ # description: PHP FastCGI Process Manager # processname: php-fpm # config: /etc/php-fpm.conf +# config: /etc/sysconfig/php-fpm # pidfile: /var/run/php-fpm/php-fpm.pid +# +### BEGIN INIT INFO +# Provides: php-fpm +# Required-Start: $local_fs $remote_fs $network $named +# Required-Stop: $local_fs $remote_fs $network +# Short-Description: start and stop PHP FPM +# Description: PHP FastCGI Process Manager +### END INIT INFO # Standard LSB functions #. /lib/lsb/init-functions @@ -34,7 +43,7 @@ start () { echo -n $"Starting $prog: " dir=$(dirname ${pidfile}) [ -d $dir ] || mkdir $dir - daemon --pidfile ${pidfile} php-fpm --daemonize + daemon --pidfile ${pidfile} /usr/sbin/php-fpm --daemonize RETVAL=$? echo [ $RETVAL -eq 0 ] && touch ${lockfile} @@ -56,8 +65,14 @@ restart () { reload () { echo -n $"Reloading $prog: " - killproc -p ${pidfile} php-fpm -USR2 - RETVAL=$? + if ! /usr/sbin/php-fpm --test ; then + RETVAL=6 + echo $"not reloading due to configuration syntax error" + failure $"not reloading $prog due to configuration syntax error" + else + killproc -p ${pidfile} php-fpm -USR2 + RETVAL=$? + fi echo } @@ -80,11 +95,15 @@ case "$1" in reload|force-reload) reload ;; + configtest) + /usr/sbin/php-fpm --test + RETVAL=$? + ;; condrestart|try-restart) [ -f ${lockfile} ] && restart || : ;; *) - echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|try-restart}" + echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|try-restart|configtest}" RETVAL=2 ;; esac -- cgit