]> git.pld-linux.org Git - packages/php.git/blame - php-fpm.init
- rel 2; rebuild with apache 2.4
[packages/php.git] / php-fpm.init
CommitLineData
0fc91222
ER
1#!/bin/sh
2#
3# php-fpm PHP FastCGI Process Manager
4#
5# chkconfig: 345 80 30
6#
7# description: PHP FastCGI Process Manager
8#
1d2cd258
ER
9# processname: php-fpm
10# config: /etc/php/php-fpm.conf
5151b487 11# pidfile: /var/run/@processname@.pid
0fc91222 12#
0fc91222
ER
13
14# Source function library
15. /etc/rc.d/init.d/functions
16
17# Get network config
18. /etc/sysconfig/network
19
d60d1735
ER
20configfile=/etc/php/php-fpm.conf
21lockfile=/var/lock/subsys/@processname@
22pidfile=$(sed -ne 's,^pid\s*=\s*\(.*\),\1,p' $configfile)
5151b487 23pidfile=${pidfile:-/var/run/@processname@.pid}
0fc91222
ER
24
25start() {
26 # Check if the service is already running?
4595983b 27 if [ -f $lockfile ]; then
0fc91222 28 msg_already_running "PHP FastCGI Process Manager"
4595983b 29 return
0fc91222 30 fi
4595983b 31
d60d1735
ER
32 msg_starting "PHP FastCGI Process Manager (@processname@)"
33 daemon --pidfile $pidfile /usr/sbin/@processname@ --fpm-config $configfile
4595983b
ER
34 RETVAL=$?
35 [ $RETVAL -eq 0 ] && touch $lockfile
0fc91222
ER
36}
37
38stop() {
4595983b 39 if [ ! -f $lockfile ]; then
0fc91222 40 msg_not_running "PHP FastCGI Process Manager"
4595983b 41 return
0fc91222 42 fi
4595983b
ER
43
44 # Stop daemons.
45 msg_stopping "PHP FastCGI Process Manager"
46 # always gracefully shut down php-fpm
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
0fc91222
ER
50}
51
52reload() {
53 local sig=${1:-HUP}
54 local retnr=${2:-7}
4595983b 55 if [ ! -f $lockfile ]; then
0fc91222
ER
56 msg_not_running "PHP FastCGI Process Manager"
57 RETVAL=$retnr
4595983b 58 return
0fc91222 59 fi
4595983b
ER
60
61 msg_reloading "PHP FastCGI Process Manager"
62 killproc --pidfile $pidfile php-fpm -$sig
63 RETVAL=$?
0fc91222
ER
64}
65
66condrestart() {
4595983b 67 if [ ! -f $lockfile ]; then
0fc91222
ER
68 msg_not_running "PHP FastCGI Process Manager"
69 RETVAL=$1
4595983b 70 return
0fc91222 71 fi
4595983b
ER
72
73 stop
74 start
0fc91222
ER
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)
d60d1735 100 status --pidfile $pidfile @processname@
0fc91222
ER
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.049064 seconds and 4 git commands to generate.