zoukankan      html  css  js  c++  java
  • 开机启动自己的服务

    #!/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')
    

      

  • 相关阅读:
    c++控制台 设置字体颜色
    c 无回显读取字符/不按回车即获取字符
    C 汉字处理
    codeblocks 汉字乱码
    [转]C/C++获取当前系统时间
    锐捷认证的一些问题&解决方法
    JAVA之BigInteger(转)【转】【很好用啊】
    常用小函数——不要重复造轮子
    字符串的朴素模式和KMP模式匹配
    直接插入排序
  • 原文地址:https://www.cnblogs.com/veviDP/p/9559766.html
Copyright © 2011-2022 走看看