I'm new to init scripts, but the one I'm using I've copied almost verbatim (I did have to change a few things around from the source I found to work with Fedora). The daemon initializes fastcgi just fine, which was a great victory. However, the init script itself never finishes running, and never returns [ok], even though the program is initialized. It just hangs at "Starting PHP FastCGI" with a blinking cursor. I can't ^C out of it, either.
The init script is below. This is a Fedora14 server.
#!/bin/sh
#chkconfig 3 85 15
#processname: php-fcgi
. /etc/rc.d/init.d/functions
php_cgi="/usr/bin/php-cgi"
prog=$(basename $php_cgi)
bind=/tmp/php.socket
php_fcgi_children=15
php_fcgi_max_requests=1000
user=root
php_cgi_args="- USER=$user PATH=/usr/bin PHP_FCGI_CHILDREN=$php_fcgi_children PHP_FCGI_MAX_REQUESTS=$php_fcgi_max_requests $php_cgi -b $bind"
RETVAL=0
start() {
echo -n "Starting PHP FastCGI: "
daemon /usr/bin/env $php_cgi_args
RETVAL=$?
echo "$prog."
}
stop() {
echo -n "Stopping PHP FastCGI: "
killall -q -w -u $user $php_cgi
RETVAL=$?
echo "$prog."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: php-fcgi {start|stop|restart}"
exit 1
;;
esac
exit $RETVAL