updated on Tue Jan 10 12:02:00 UTC 2012
[aur-mirror.git] / hiawatha / php-fcgi
blob54e52418720414f5b701cb30c6b90b8f3e6ef7c2
1 #!/bin/bash
3 # PHP-FastCGI start/stop script
5 . /etc/rc.conf
6 . /etc/rc.d/functions
8 PATH="/bin:/usr/bin:/sbin:/usr/sbin"
9 PHP_FCGI="/usr/sbin/php-fcgi"
10 PIDFILE="/var/run/php-fcgi.pid"
12 test -f ${PHP_FCGI} || exit 0
14 function start_php_fcgi {
15 if [ -f ${PIDFILE} ]; then
16 stat_busy "FastCGI is already running"
17 stat_done
18 else
19 fcgi_ver=`/usr/sbin/php-fcgi -v`
20 stat_busy "Starting ${fcgi_ver}"
21 ${PHP_FCGI} &> /dev/null
22 result=$?
23 if [ "${result}" = "0" ]; then
24 add_daemon php-fcgi
25 stat_done
26 else
27 fcgi_Error=`/usr/sbin/php-fcgi 2>&1`
28 stat_busy "$fcgi_Error"
29 stat_fail
34 function stop_php_fcgi {
35 if [ -f ${PIDFILE} ]; then
36 stat_busy "Stopping PHP FastCGI server daemons"
37 ${PHP_FCGI} -k &> /dev/null
38 stat_done
39 else
40 stat_busy "FastCGI is not running"
41 stat_done
45 case "$1" in
46 start)
47 start_php_fcgi
49 stop)
50 stop_php_fcgi
52 restart)
53 stop_php_fcgi
54 start_php_fcgi
57 echo "Usage: $0 {start|stop|restart}"
58 exit 1
60 esac
62 exit 0