美文网首页我爱编程
centos7.4——8.运行spring cloud的jar文

centos7.4——8.运行spring cloud的jar文

作者: AnubisAwooo | 来源:发表于2018-04-05 22:52 被阅读0次

centos7.4——运行spring cloud的jar文件相关

#!/bin/sh
name=xxx
path=/mine/app
case "$1" in
    start)
        #启动
        nohup /usr/local/jdk/bin/java -jar $path/$name.jar > /dev/null 2>&1 &
        ;;
    stop)
        #停止
        ps -ef | grep "$name.jar" | grep -v grep | awk '{print $2}' | xargs kill -9
        ;;
    check)
        #检查并执行
        count=`ps -ef | grep "$name.jar" | grep -v grep | awk '{print $2}' | wc -l`
        if [ $count -lt 1 ]; then
            nohup /usr/local/jdk/bin/java -jar $path/$name.jar > /dev/null 2>&1 &
        fi
        ;;
    *)
        echo 'Please use start or stop or check as first argument'
        ;;
esac

相关文章

网友评论

    本文标题:centos7.4——8.运行spring cloud的jar文

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