1、可通过 service spider start|stop|status|restart 命令对服务进行控制
2、spider服务可开机自启动
start()
{
echo "start spider"
/home/projects/spider/spider -d &
exit 0;
}
stop()
{
echo -n "stop spider"
if pkill spider
then
echo " [ok]"
else
echo " [failed]"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "usage: $0 start|stop|restart"
exit 0;
esac