opt/php-fcgi/php-fcgi

42 lines
790 B
Bash

#!/bin/sh
#
# /etc/rc.d/php-fcgi: start/stop FastCGI php daemon
#
SSD=/sbin/start-stop-daemon
PROG=/usr/bin/php-cgi
PID=/var/run/php-fcgi.pid
PORT="127.0.0.1:8000"
#PORT="/tmp/php_fcgi.sock"
OPTS="-b $PORT"
USR=www
COUNT=8
case $1 in
start)
export PHP_FCGI_CHILDREN=$COUNT
$SSD --start -bm --chuid $USR --pidfile $PID --exec $PROG -- $OPTS
;;
stop)
$SSD --stop --remove-pidfile --retry 10 --pidfile $PID
;;
restart)
$0 stop
$0 start
;;
status)
$SSD --status --pidfile $PID
case $? in
0) echo "$PROG is running with pid $(cat $PID)" ;;
1) echo "$PROG is not running but the pid file $PID exists" ;;
3) echo "$PROG is not running" ;;
4) echo "Unable to determine the program status" ;;
esac
;;
*)
echo "usage: $0 [start|stop|restart|reload|status]"
;;
esac
# End of file