开机启动自己的服务
#!/bin/sh #add for chkconfig #chkconfig: 2345 70 30 #description: the description of the shell #启动MQANT服务 #processname: andyStart : #第一个进程名,后边设置自启动的时候会用到 #1. vi /etc/init.d/mqant #2. paste shell content #3. chmod +x /etc/init.d/mqant #4. chkconfig mqant on #5. service mqant start #下面要启动服务的命令 #/usr/local/vevigame/veviserver/bin/server --conf /usr/local/vevigame/veviserver/bin/conf/serverl.conf #PT=/usr/local/vevigame/veviserver/bin #EXEC=/usr/local/vevisoft/mqantserver/bin/server #CONF=/usr/local/vevisoft/mqantserver/bin/conf/serverl.json #LOG=/usr/local/vevisoft/mqantserver/bin/logs EXEC=/usr/local/vevigame/mqantserver/bin/server CONF=/usr/local/vevigame/mqantserver/bin/conf/serverl.json LOG=/usr/local/vevigame/mqantserver/bin/logs case $1 in start) if [ -f $EXEC ] then echo "$EXEC exists! server is starting..." nohup $EXEC --conf $CONF --log $LOG & echo "server start success" else echo "ERROR:$EXEC not exists ,server can not start..." fi ;; stop) kill -9 $(ps -ef|grep -v grep|grep '\-\-conf') if [ $? -eq 0 ] then echo "mqant is stop..." #killall -9 $PID else echo "ERROR:mqant is not stop,there is something errors!" fi ;; exit) pid=$(ps -ef|grep -v grep|grep '\-\-conf') for i in $pid do echo "Kill the $1 process [$i]" kill -9 $i done ;; restart|force-reload) ${0} stop ${0} start ;; *) echo "Usage: $name [start|stop|restart]" exit 1 ;; esac exit 0 #kill -9 $(ps -ef|grep -v grep|grep '\-\-conf')