美文网首页
shell 启动java

shell 启动java

作者: HaoDongZ | 来源:发表于2021-01-07 11:29 被阅读0次
    
    #!/bin/bash
    DIR="cd /opt/xxx/xxx"
    APP_NAME="xxx-xxx-xxx-boot-1.0-SNAPSHOT.jar"
    case $1 in
        start)
        nohup   /opt/jdk1.8/bin/java -jar -Xms256m -Xmx256m -XX:-HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./logs -Dspring.profiles.active=uat ${DIR}${APP_NAME} > /dev/null &
            echo ${APP_NAME} start!
            ;;
        stop)
            ps -ef| grep ${APP_NAME} |grep -v grep |awk '{print $2}'  | sed -e "s/^/kill -9 /g" | sh -
            echo ${APP_NAME} stop!
            ;;
        restart)
            "$0" stop
            sleep 3
            "$0" start
            ;;
        status)  ps -aux | grep ${APP_NAME} | grep -v 'grep'
            ;;
        log)
        case $2 in
    debug)
    tail -f -n ${3-400} logs/debug.log
    ;;
    error)
    tail -f -n ${3-400} logs/error.log
    ;;
    *)
    echo "Example: services.sh log {debug|error}" ;;
    esac
            ;;
        *)
            echo "Example: services.sh [start|stop|restart|status]" ;;
    esac
    
    

    相关文章

      网友评论

          本文标题:shell 启动java

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