路径 /etc/init.d/yearning
#!/bin/bash
# description: yearning Start Stop Restart
# processname: yearning
# chkconfig: 2345 55 25
CATALINA_HOME=/data/Yearning-go
case $1 in
start)
cd $CATALINA_HOME
nohup ./Yearning -s >/dev/null 2>&1 &
cd
;;
stop)
ps -e|grep Yearning|awk '{print "kill -9 "$1}'|sh
;;
restart)
ps -e|grep Yearning|awk '{print "kill -9 "$1}'|sh
sleep 1
cd $CATALINA_HOME
nohup ./Yearning -s >/dev/null 2>&1 &
cd
;;
*)
echo 'please use : Yearning {start | stop | restart}'
;;
esac
exit 0
chkconfig --add yearning
chkconfig yearning on