diff options
author | Remi Collet <fedora@famillecollet.com> | 2014-01-28 17:50:23 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2014-01-28 17:50:23 +0100 |
commit | bb999a6fde2775c8522740918c8e292122ab33ff (patch) | |
tree | 0448234c1bf057bab26d164ad3d3e15888538466 | |
parent | 980369ec69d7e495814d24e3bfa5b483353d66ac (diff) |
improves php-fpm sysvinit script
-rwxr-xr-x | php-fpm.init | 27 |
1 files changed, 23 insertions, 4 deletions
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 |