spring boot jar 部署linux服务器

2017-09-28  本文已影响95人  无至

star.sh

    #!/bin/sh  
      
    rm -f tpid  
      
    nohup java -jar /data/app/myapp.jar --spring.profiles.active=stg > /dev/null 2>&1 &  
      
    echo $! > tpid  

stop.sh

    tpid=`cat tpid | awk '{print $1}'`  
    tpid=`ps -aef | grep $tpid | awk '{print $2}' |grep $tpid`  
    if [ ${tpid} ]; then  
            kill -9 $tpid  
    fi  

check.sh

    #!/bin/sh  
      
    tpid=`cat tpid | awk '{print $1}'`  
    tpid=`ps -aef | grep $tpid | awk '{print $2}' |grep $tpid`  
    if [ ${tpid} ]; then  
            echo App is running.  
    else  
            echo App is NOT running.  
    fi  

kill.sh

    #!/bin/sh  
    # kill -9 `ps -ef|grep 项目名称|awk '{print $2}'`  
    kill -9 `ps -ef|grep demo|awk '{print $2}'`  
上一篇下一篇

猜你喜欢

热点阅读