slackbuilds_ponce/network/hiawatha/rc.php-fcgi
Antonio Hernández Blas 3eb225482b network/hiawatha: Updated for version 7.4.
Signed-off-by: Niels Horn <niels.horn@slackbuilds.org>
2011-03-04 07:37:26 -03:00

58 lines
1.1 KiB
Bash

#!/bin/sh
# Start/stop/restart PHP as FastCGI daemon
# Copyright (c) 2009-2010 Antonio Hernández Blas <hba.nihilismus@gmail.com>
CONF='/etc/hiawatha/php-fcgi.conf'
CMMD="/usr/sbin/php-fcgi -c $CONF"
php_fcgi_start() {
if [ -x /usr/sbin/php-fcgi ]; then
if [ -f $CONF ]; then
PIDOF=$(pgrep -f /usr/bin/php-cgi)
if [ ! -z "$PIDOF" ]; then
echo "Error, PHP as FastCGI daemon is already running."
else
echo "Starting PHP as FastCGI daemon: $CMMD"
$CMMD
fi
else
echo "Error, file $CONF does not exist."
fi
fi
}
php_fcgi_stop() {
echo "Stoping PHP as FastCGI daemon: /usr/sbin/php-fcgi -k"
/usr/sbin/php-fcgi -k
}
php_fcgi_status() {
PIDOF=$(pgrep -f /usr/bin/php-cgi)
if [ ! -z "$PIDOF" ]; then
echo "PHP as FastCGI daemon is running."
else
echo "PHP as FastCGI daemon is not running."
fi
}
case $1 in
start)
php_fcgi_start
;;
stop)
php_fcgi_stop
;;
restart)
php_fcgi_stop
sleep 3
php_fcgi_start
;;
status)
php_fcgi_status
;;
*)
echo "Usage $0 {start|stop|restart|status}"
exit 1
;;
esac