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')
    

      

  • 相关阅读:
    【Python】supervisor安装和管理celery
    【MySQL】pt-query-digest数据处理并关联业务
    【Python】pip国内安装源和yum恢复
    【Python】Celery异步处理
    【转】Java中堆和栈的区别
    三种简单排序算法
    哈夫曼(Huffman)编码
    SpringMVC之文件上传
    SpringMVC之类型转换
    SpringMVC之表单校验
  • 原文地址:https://www.cnblogs.com/veviDP/p/9559766.html
Copyright © 2011-2022 走看看