美文网首页
shell-jar启动

shell-jar启动

作者: 任嘉平生愿 | 来源:发表于2019-11-12 17:43 被阅读0次

    #!/bin/bash

    #author chenyue

    echo "member deployment!"

    #拿到pid

    member_pid=`ps x | grep mutms-member-uat.jar | grep -v grep | awk '{print $1}'`

    if [ -z "$member_pid"  ];then

    #pid不存在直接启动jar

    nohup java -jar mutms-member-uat.jar >member.log 2>&1 &

    else

    #杀掉pid再启动jar

    kill -9 $member_pid

    nohup java -jar mutms-member-uat.jar >member.log 2>&1 &

    fi

    echo "member deployment ok!"

    -----------------------------------------------------------------------------------------------------------------------

    #!/bin/bash

    #author chenyue

    read -p "请输入jar名称 例: mutms-iservice-sale-uat.jar  " jarname

    read -p "请输入日志存放名称 例: sale.log  " logpath

    echo $jarname" deployment!"

    #拿到pid

    member_pid=`ps x | grep $jarname | grep -v grep | awk '{print $1}'`

    if [ -z "$member_pid"  ];then

    #pid不存在直接启动jar

    nohup java -jar $jarname >$logpath 2>&1 &

    else

    #杀掉pid再启动jar

    kill -9 $member_pid

    nohup java -jar $jarname >$logpath 2>&1 &

    fi

    echo $jarname" deployment ok!"

    相关文章

      网友评论

          本文标题:shell-jar启动

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