Created
July 12, 2011 22:04
-
-
Save rchampourlier/1079094 to your computer and use it in GitHub Desktop.
SystemV service startup script for php-fcgi for reverse proxied php on nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# php-fcgi Start and stop FastCGI processes | |
# | |
# chkconfig: - 80 20 | |
# description: Spawn FastCGI scripts to be used by web servers | |
### BEGIN INIT INFO | |
# Provides: php-fcgi | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: PHP5 FastCgi Spawned processes | |
### END INIT INFO | |
# Source function library. | |
. /etc/rc.d/init.d/functions | |
COMMAND=/usr/bin/spawn-fcgi | |
ADDRESS=127.0.0.1 | |
PORT=9000 | |
USER=www | |
GROUP=www | |
PHPCGI=/usr/bin/php-cgi | |
PIDFILE=/var/run/fastcgi-php.pid | |
RETVAL=0 | |
PHP_FCGI_MAX_REQUESTS=500 | |
PHP_FCGI_CHILDREN=2 | |
start() { | |
echo -n $"Starting $PHPCGI: " | |
export PHP_FCGI_MAX_REQUESTS PHP_FCGI_CHILDREN | |
$COMMAND -a $ADDRESS -p $PORT -u $USER -g $GROUP -f $PHPCGI -P $PIDFILE | |
retval=$? | |
echo | |
return $retval | |
} | |
stop() { | |
echo -n $"Stopping $PHPCGI: " | |
/usr/bin/killall -9 php-cgi | |
retval=$? | |
echo | |
return $retval | |
} | |
case "$1" in | |
start) | |
start | |
RETVAL=$? | |
;; | |
stop) | |
stop | |
RETVAL=$? | |
;; | |
restart|reload) | |
stop | |
start | |
RETVAL=$? | |
;; | |
*) | |
echo "Usage: fastcgi {start|stop|restart}" | |
exit 1 | |
;; | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment