]> git.pld-linux.org Git - packages/php.git/blob - php-fpm.init
- my version of 5.2.7 merge
[packages/php.git] / php-fpm.init
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 #
9 # processname:  php.fpm
10 # config:       /etc/php/fpm.conf
11 # pidfile:      /var/run/php/fpm.pid
12 #
13 # $Id$
14
15 # Source function library
16 . /etc/rc.d/init.d/functions
17
18 # Get network config
19 . /etc/sysconfig/network
20
21 pidfile=/var/run/php/fpm.pid
22
23 start() {
24         # Check if the service is already running?
25         if [ ! -f /var/lock/subsys/php-fpm ]; then
26                 msg_starting "PHP FastCGI Process Manager"
27                 daemon /usr/bin/php.fpm --fpm --fpm-config /etc/php/fpm.conf
28                 RETVAL=$?
29                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/php-fpm
30         else
31                 msg_already_running "PHP FastCGI Process Manager"
32         fi
33 }
34
35 stop() {
36         if [ -f /var/lock/subsys/php-fpm ]; then
37                 # Stop daemons.
38                 msg_stopping "PHP FastCGI Process Manager"
39                 # always gracefully shut down php-fpm
40                 killproc --pidfile $pidfile php-fpm -QUIT
41                 rm -f /var/lock/subsys/php-fpm
42         else
43                 msg_not_running "PHP FastCGI Process Manager"
44         fi
45 }
46
47 reload() {
48         local sig=${1:-HUP}
49         local retnr=${2:-7}
50         if [ -f /var/lock/subsys/php-fpm ]; then
51                 msg_reloading "PHP FastCGI Process Manager"
52                 killproc --pidfile $pidfile php-fpm -$sig
53                 RETVAL=$?
54         else
55                 msg_not_running "PHP FastCGI Process Manager"
56                 RETVAL=$retnr
57         fi
58 }
59
60 condrestart() {
61         if [ -f /var/lock/subsys/php-fpm ]; then
62                 stop
63                 start
64         else
65                 msg_not_running "PHP FastCGI Process Manager"
66                 RETVAL=$1
67         fi
68 }
69
70 RETVAL=0
71 # See how we were called.
72 case "$1" in
73   start)
74         start
75         ;;
76   stop|quit)
77         stop
78         ;;
79   restart)
80         stop
81         start
82         ;;
83   try-restart)
84         condrestart 0
85         ;;
86   reload|force-reload)
87         reload USR2 7
88         ;;
89   flush-logs|logrotate)
90         reload USR1 0
91         ;;
92   status)
93         status php-fpm php.fpm
94         RETVAL=$?
95         ;;
96   *)
97         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|flush-logs|status}"
98         exit 3
99         ;;
100 esac
101
102 exit $RETVAL
This page took 0.029149 seconds and 3 git commands to generate.