]> git.pld-linux.org Git - packages/php.git/blame - php-fpm.init
common should not provide hash, we have php-hash package
[packages/php.git] / php-fpm.init
CommitLineData
c0240cb1 1#!/bin/sh
2#
654a0f7f 3# @processname@ PHP FastCGI Process Manager
c0240cb1 4#
5# chkconfig: 345 80 30
6#
7# description: PHP FastCGI Process Manager
8#
654a0f7f 9# processname: @processname@
c0240cb1 10# config: /etc/php/php-fpm.conf
1ffcc879 11# pidfile: /var/run/@processname@.pid
c0240cb1 12#
c0240cb1 13
14# Source function library
15. /etc/rc.d/init.d/functions
16
17# Get network config
18. /etc/sysconfig/network
19
ee5a2c46 20configfile=/etc/php/php-fpm.conf
654a0f7f 21lockfile=/var/lock/subsys/@processname@
ee5a2c46 22pidfile=$(sed -ne 's,^pid\s*=\s*\(.*\),\1,p' $configfile)
1ffcc879 23pidfile=${pidfile:-/var/run/@processname@.pid}
c0240cb1 24
25start() {
26 # Check if the service is already running?
873fb29e 27 if [ -f $lockfile ]; then
654a0f7f 28 msg_already_running "PHP FastCGI Process Manager (@processname@)"
873fb29e 29 return
c0240cb1 30 fi
873fb29e 31
654a0f7f 32 msg_starting "PHP FastCGI Process Manager (@processname@)"
b3839a9b 33 daemon --redirfds --pidfile $pidfile /usr/sbin/@processname@ --fpm-config $configfile
873fb29e
ER
34 RETVAL=$?
35 [ $RETVAL -eq 0 ] && touch $lockfile
c0240cb1 36}
37
38stop() {
873fb29e 39 if [ ! -f $lockfile ]; then
654a0f7f 40 msg_not_running "PHP FastCGI Process Manager (@processname@)"
873fb29e 41 return
c0240cb1 42 fi
873fb29e
ER
43
44 # Stop daemons.
654a0f7f
ER
45 msg_stopping "PHP FastCGI Process Manager (@processname@)"
46 # always gracefully shut down @processname@
873fb29e
ER
47 /sbin/start-stop-daemon -q --stop -s QUIT --retry QUIT/600/TERM/10 --pidfile $pidfile
48 [ "$?" -eq 0 ] && ok || fail
49 rm -f $lockfile
c0240cb1 50}
51
52reload() {
53 local sig=${1:-HUP}
54 local retnr=${2:-7}
873fb29e 55 if [ ! -f $lockfile ]; then
654a0f7f 56 msg_not_running "PHP FastCGI Process Manager (@processname@)"
c0240cb1 57 RETVAL=$retnr
873fb29e 58 return
c0240cb1 59 fi
873fb29e 60
654a0f7f
ER
61 msg_reloading "PHP FastCGI Process Manager (@processname@)"
62 killproc --pidfile $pidfile @processname@ -$sig
873fb29e 63 RETVAL=$?
c0240cb1 64}
65
66condrestart() {
873fb29e 67 if [ ! -f $lockfile ]; then
654a0f7f 68 msg_not_running "PHP FastCGI Process Manager (@processname@)"
c0240cb1 69 RETVAL=$1
873fb29e 70 return
c0240cb1 71 fi
873fb29e
ER
72
73 stop
74 start
c0240cb1 75}
76
77RETVAL=0
78# See how we were called.
79case "$1" in
80 start)
81 start
82 ;;
83 stop|quit)
84 stop
85 ;;
86 restart)
87 stop
88 start
89 ;;
90 try-restart)
91 condrestart 0
92 ;;
93 reload|force-reload)
94 reload USR2 7
95 ;;
96 flush-logs|logrotate)
97 reload USR1 0
98 ;;
99 status)
ee5a2c46 100 status --pidfile $pidfile @processname@
c0240cb1 101 RETVAL=$?
102 ;;
103 *)
104 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|flush-logs|status}"
105 exit 3
106 ;;
107esac
108
109exit $RETVAL
This page took 0.536649 seconds and 4 git commands to generate.