]> git.pld-linux.org Git - packages/php.git/blobdiff - php-fpm.init
- rel 2
[packages/php.git] / php-fpm.init
index 9ce2b56a141a9180b13b62bbacab027f9a6d6df9..d75da1c27f9780a6d299951fc6c366c7f01c1c3f 100644 (file)
@@ -1,14 +1,14 @@
 #!/bin/sh
 #
-# php-fpm      PHP FastCGI Process Manager
+# @processname@        PHP FastCGI Process Manager
 #
 # chkconfig:   345 80 30
 #
 # description: PHP FastCGI Process Manager
 #
-# processname: php-fpm
+# processname: @processname@
 # config:      /etc/php/php-fpm.conf
-# pidfile:     /var/run/php/fpm.pid
+# pidfile:     /var/run/@processname@.pid
 #
 
 # Source function library
 # Get network config
 . /etc/sysconfig/network
 
-pidfile=/var/run/php/php-fpm.pid
-lockfile=/var/lock/subsys/php-fpm
+configfile=/etc/php/php-fpm.conf
+lockfile=/var/lock/subsys/@processname@
+pidfile=$(sed -ne  's,^pid\s*=\s*\(.*\),\1,p' $configfile)
+pidfile=${pidfile:-/var/run/@processname@.pid}
 
 start() {
        # Check if the service is already running?
        if [ -f $lockfile ]; then
-               msg_already_running "PHP FastCGI Process Manager"
+               msg_already_running "PHP FastCGI Process Manager (@processname@)"
                return
        fi
 
-       msg_starting "PHP FastCGI Process Manager"
-       daemon --pidfile $pidfile /usr/sbin/php-fpm --fpm-config /etc/php/php-fpm.conf
+       msg_starting "PHP FastCGI Process Manager (@processname@)"
+       daemon --redirfds --pidfile $pidfile /usr/sbin/@processname@ --fpm-config $configfile
        RETVAL=$?
        [ $RETVAL -eq 0 ] && touch $lockfile
 }
 
 stop() {
        if [ ! -f $lockfile ]; then
-               msg_not_running "PHP FastCGI Process Manager"
+               msg_not_running "PHP FastCGI Process Manager (@processname@)"
                return
        fi
 
        # Stop daemons.
-       msg_stopping "PHP FastCGI Process Manager"
-       # always gracefully shut down php-fpm
+       msg_stopping "PHP FastCGI Process Manager (@processname@)"
+       # always gracefully shut down @processname@
        /sbin/start-stop-daemon -q --stop -s QUIT --retry QUIT/600/TERM/10 --pidfile $pidfile
        [ "$?" -eq 0 ] && ok || fail
        rm -f $lockfile
@@ -51,19 +53,19 @@ reload() {
        local sig=${1:-HUP}
        local retnr=${2:-7}
        if [ ! -f $lockfile ]; then
-               msg_not_running "PHP FastCGI Process Manager"
+               msg_not_running "PHP FastCGI Process Manager (@processname@)"
                RETVAL=$retnr
                return
        fi
 
-       msg_reloading "PHP FastCGI Process Manager"
-       killproc --pidfile $pidfile php-fpm -$sig
+       msg_reloading "PHP FastCGI Process Manager (@processname@)"
+       killproc --pidfile $pidfile @processname@ -$sig
        RETVAL=$?
 }
 
 condrestart() {
        if [ ! -f $lockfile ]; then
-               msg_not_running "PHP FastCGI Process Manager"
+               msg_not_running "PHP FastCGI Process Manager (@processname@)"
                RETVAL=$1
                return
        fi
@@ -95,7 +97,7 @@ case "$1" in
        reload USR1 0
        ;;
   status)
-       status php-fpm
+       status  --pidfile $pidfile @processname@
        RETVAL=$?
        ;;
   *)
This page took 0.028101 seconds and 4 git commands to generate.