]> andersk Git - sql.git/blame - etc/init.d/php
php: init.d script
[sql.git] / etc / init.d / php
CommitLineData
7d4d1b66
JP
1#!/bin/sh
2#
3# Created 2010-09-26 by presbrey@mit.edu
4#
5# php This shell script takes care of starting and stopping PHP
6#
7# chkconfig: - 80 30
8# description: manages PHP spawned in FastCGI mode with spawn-fcgi
9# processname: php-cgi
10# config: /etc/php.ini
11
12
13# Source function library
14if [ -f /etc/rc.d/init.d/functions ]; then
15. /etc/rc.d/init.d/functions
16elif [ -f /etc/init.d/functions ]; then
17. /etc/init.d/functions
18elif [ -f /etc/rc.d/functions ]; then
19. /etc/rc.d/functions
20fi
21
22pidfile=${PIDFILE-/var/run/php.pid}
23lockfile=${LOCKFILE-/var/lock/subsys/php}
24PHP_BIN=/usr/bin/php-cgi
25PHP_SOCK=/tmp/php.sock
26PHP_USER=lighttpd
27PHP_GROUP=apache
28PHP_CHILDREN=8
29
30# Read configuration (environment etc.)
31if [ -f /etc/sysconfig/php ]; then
32 . /etc/sysconfig/php
33fi
34
35RETVAL=0
36
37# See how we were called.
38case "$1" in
39 start)
40 # Start daemons.
41 echo -n "Starting php: "
42 daemon --pidfile=${pidfile} spawn-fcgi -C $PHP_CHILDREN -f $PHP_BIN -u $PHP_USER -g $PHP_GROUP -s $PHP_SOCK -P $pidfile
43 RETVAL=$?
44 echo
45 [ $RETVAL = 0 ] && touch ${lockfile}
46 ;;
47 stop)
48 # Stop daemons.
49 echo -n "Stopping php: "
50 killproc -p ${pidfile} -d 1 $PID_BIN -9
51 RETVAL=$?
52 echo
53 [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
54 ;;
55 restart)
56 $0 stop
57 $0 start
58 ;;
59 status)
60 status -p $pidfile $PHP_BIN
61 RETVAL=$?
62 ;;
63 *)
64 echo "Usage: php {start|stop|restart|reload|status}"
65 RETVAL=2
66esac
67
68exit $RETVAL
This page took 0.050655 seconds and 5 git commands to generate.