immortalwrt/package/jsda/fcgiwrap/files/fcgiwrap.init
2019-07-02 18:06:49 +08:00

63 lines
1.2 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh /etc/rc.common
#by guogh
USE_PROCD=1
START=99
SPAWN_FCGI="/usr/bin/spawn-fcgi"
DAEMON="/usr/sbin/fcgiwrap"
NAME="fcgiwrap"
PIDFILE="/var/run/$NAME.pid"
FCGI_SOCKET="/tmp/$NAME.socket"
FCGI_USER="www"
FCGI_GROUP="www"
FORK_NUM=2
start_service() {
echo -e "Starting $NAME ..."
#procd_set_param command $SPAWN_FCGI -u $FCGI_USER -g $FCGI_GROUP -s $FCGI_SOCKET -P $PIDFILE -F $FORK_NUM -f $DAEMON
$SPAWN_FCGI -a 127.0.0.1 -p 9000 -f $DAEMON -F $FORK_NUM
}
stop_service(){
PID=`pidof $NAME`
#i=1
#for p in $PID
#do
# if [ $i -eq 1 ]; then
# let i++
# continue
# fi
# echo -n "$p "
#done
#因为脚本执行时第一个pid是脚本的所以要去除
if [ -n "`echo $PID | grep ' '`" ]; then
SPID=${PID#* }
echo -e "Kill $NAME (PID: $SPID)."
kill -9 $SPID
else
echo -e "Warning: $NAME is not runing."
fi
exit 0
}
restart(){
PID=`pidof $NAME`
#因为脚本执行时第一个pid是脚本的所以要去除
if [ -n "`echo $PID | grep ' '`" ]; then
SPID=${PID#* }
echo -e "Kill $NAME (PID: $SPID)."
kill -9 $SPID
else
echo -e "Warning: $NAME is not runing."
fi
start_service
}