summaryrefslogtreecommitdiffstats
path: root/php-fpm.init
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2014-09-02 18:24:41 +0200
committerRemi Collet <fedora@famillecollet.com>2014-09-02 18:24:41 +0200
commit45396e0b548b5684022506133d06a721cd9cd6de (patch)
tree8e8931e2d2cb869f08bf57c5c5eafef2b13a1d1f /php-fpm.init
php55-php: import from rhscl 1.1
Diffstat (limited to 'php-fpm.init')
-rw-r--r--php-fpm.init111
1 files changed, 111 insertions, 0 deletions
diff --git a/php-fpm.init b/php-fpm.init
new file mode 100644
index 0000000..63aac66
--- /dev/null
+++ b/php-fpm.init
@@ -0,0 +1,111 @@
+#! /bin/sh
+#
+# chkconfig: - 84 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
+
+# Source function library.
+. /etc/init.d/functions
+
+# Check that networking is up.
+. /etc/sysconfig/network
+
+# Additional environment file
+if [ -f /etc/sysconfig/php-fpm ]; then
+ . /etc/sysconfig/php-fpm
+fi
+
+if [ "$NETWORKING" = "no" ]
+then
+ exit 0
+fi
+
+RETVAL=0
+prog="php-fpm"
+pidfile=${PIDFILE-/var/run/php-fpm/php-fpm.pid}
+lockfile=${LOCKFILE-/var/lock/subsys/php-fpm}
+
+start () {
+ echo -n $"Starting $prog: "
+ dir=$(dirname ${pidfile})
+ [ -d $dir ] || mkdir $dir
+ daemon --pidfile ${pidfile} /usr/sbin/php-fpm --daemonize
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch ${lockfile}
+}
+stop () {
+ echo -n $"Stopping $prog: "
+ killproc -p ${pidfile} php-fpm
+ RETVAL=$?
+ echo
+ if [ $RETVAL -eq 0 ] ; then
+ rm -f ${lockfile} ${pidfile}
+ fi
+}
+
+restart () {
+ stop
+ start
+}
+
+reload () {
+ echo -n $"Reloading $prog: "
+ 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
+}
+
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status -p ${pidfile} php-fpm
+ RETVAL=$?
+ ;;
+ restart)
+ restart
+ ;;
+ 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|configtest}"
+ RETVAL=2
+ ;;
+esac
+
+exit $RETVAL