]> git.pld-linux.org Git - packages/php.git/blame - php-fpm.init
fix php-config --php-sapis
[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
654a0f7f 11# pidfile: /var/run/php/@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
654a0f7f
ER
20pidfile=/var/run/php/@processname@.pid
21lockfile=/var/lock/subsys/@processname@
c0240cb1 22
23start() {
24 # Check if the service is already running?
873fb29e 25 if [ -f $lockfile ]; then
654a0f7f 26 msg_already_running "PHP FastCGI Process Manager (@processname@)"
873fb29e 27 return
c0240cb1 28 fi
873fb29e 29
654a0f7f
ER
30 msg_starting "PHP FastCGI Process Manager (@processname@)"
31 daemon --pidfile $pidfile /usr/sbin/@processname@ --fpm-config /etc/php/php-fpm.conf
873fb29e
ER
32 RETVAL=$?
33 [ $RETVAL -eq 0 ] && touch $lockfile
c0240cb1 34}
35
36stop() {
873fb29e 37 if [ ! -f $lockfile ]; then
654a0f7f 38 msg_not_running "PHP FastCGI Process Manager (@processname@)"
873fb29e 39 return
c0240cb1 40 fi
873fb29e
ER
41
42 # Stop daemons.
654a0f7f
ER
43 msg_stopping "PHP FastCGI Process Manager (@processname@)"
44 # always gracefully shut down @processname@
873fb29e
ER
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
654a0f7f 54 msg_not_running "PHP FastCGI Process Manager (@processname@)"
c0240cb1 55 RETVAL=$retnr
873fb29e 56 return
c0240cb1 57 fi
873fb29e 58
654a0f7f
ER
59 msg_reloading "PHP FastCGI Process Manager (@processname@)"
60 killproc --pidfile $pidfile @processname@ -$sig
873fb29e 61 RETVAL=$?
c0240cb1 62}
63
64condrestart() {
873fb29e 65 if [ ! -f $lockfile ]; then
654a0f7f 66 msg_not_running "PHP FastCGI Process Manager (@processname@)"
c0240cb1 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)
654a0f7f 98 status @processname@
c0240cb1 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.048816 seconds and 4 git commands to generate.