#!/bin/bashPHP_SCRIPT=/usr/bin/php-fastcgiFASTCGI_USER=www-dataFASTCGI_GROUP=www-dataPID_DIR=/var/run/php-fastcgiPID_FILE=/var/run/php-fastcgi/php-fastcgi.pidRET_VAL=0case"$1"instart)if[[!-d$PID_DIR]]thenmkdir$PID_DIRchown$FASTCGI_USER:$FASTCGI_GROUP$PID_DIRchmod0770$PID_DIRfiif[[-r$PID_FILE]]thenecho"php-fastcgi already running with PID `cat $PID_FILE`"RET_VAL=1else$PHP_SCRIPTRET_VAL=$?fi;;stop)if[[-r$PID_FILE]]thenkill`cat $PID_FILE`rm$PID_FILERET_VAL=$?elseecho"Could not find PID file $PID_FILE"RET_VAL=1fi;;restart)if[[-r$PID_FILE]]thenkill`cat $PID_FILE`rm$PID_FILERET_VAL=$?elseecho"Could not find PID file $PID_FILE"fi$PHP_SCRIPTRET_VAL=$?;;status)if[[-r$PID_FILE]]thenecho"php-fastcgi running with PID `cat $PID_FILE`"RET_VAL=$?elseecho"Could not find PID file $PID_FILE, php-fastcgi does not appear to be running"fi;;*)echo"Usage: php-fastcgi {start|stop|restart|status}"RET_VAL=1;;esacexit$RET_VAL