美文网首页
jar 启动脚本

jar 启动脚本

作者: YANG_ad29 | 来源:发表于2021-04-07 11:00 被阅读0次


#!/bin/bash

jarbao="corss-1.0.0"

case $1 in
    start)
   geshu1=`ps -ef|grep "$jarbao.jar"|grep -v "grep"|wc -l`
    if [ $geshu1 == 1 ];then
        echo "program is running"
    else
   nohup java -Xmx512m -Xms256m -jar /home/cross/"$jarbao".jar &>> /home/cross/logs/"$jarbao".log &
     fi

    ;;
    stop)
    geshu=`ps -ef|grep "$jarbao.jar"|grep -v "grep"|wc -l`
    if [ $geshu == 1 ];then
        pid=`ps -ef|grep "$jarbao.jar"|grep -v "grep"|awk '{print $2}'`
        kill -9 $pid
    else
        echo "program is stop"
    fi

    ;;
    *)
    echo "Usage:[start|stop])"
esac





相关文章

网友评论

      本文标题:jar 启动脚本

      本文链接:https://www.haomeiwen.com/subject/fpnykltx.html