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