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