Skip to content

Instantly share code, notes, and snippets.

@phred
Created November 17, 2009 22:14
Show Gist options
  • Save phred/237322 to your computer and use it in GitHub Desktop.
Save phred/237322 to your computer and use it in GitHub Desktop.
init.d script example for controlling a PHP FastCGI pool
#!/bin/bash
# chkconfig: - 85 15
# description: controls the pool of PHP FastCGI daemons used to handle \
# dynamic requests from nginx.
PHP_SCRIPT=/opt/nginx/bin/world_php_fcgi
RETVAL=0
case "$1" in
start)
$PHP_SCRIPT
RETVAL=$?
;;
stop)
killall -9 php-cgi
RETVAL=$?
;;
restart)
killall -9 php-cgi
$PHP_SCRIPT
RETVAL=$?
;;
*)
echo "Usage: php-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