summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2014-01-28 17:50:23 +0100
committerRemi Collet <fedora@famillecollet.com>2014-01-28 17:50:23 +0100
commita455353d3e21591879325e69dab98438b0a67d88 (patch)
tree3c09e6653b9f3332ab8f4e7c933b5985652de47e
parent8d1b6095e683364e1d4b7dbb4a508c57a401e5a5 (diff)
improves php-fpm sysvinit script
-rwxr-xr-xphp-fpm.init27
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