zoukankan      html  css  js  c++  java
  • springboot 启动脚本获取pid问题

    #! /bin/bash
    
    APP='eureka-1.0.0.jar'
    active='slave'
    pid=$(pgrep -f $APP)
    
    export JAVA_OPTS="-server -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xms1024m -Xmx1024m -Xmn256m -Xss256k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC"
    
    start() {
    if [ -n "$pid" ]; then
    echo "[$APP] already start, pid:&pid"
    kill -9 $pid
    #return 0
    fi
    
    #nohup java -jar $APP --spring.profiles.active=$active | /usr/sbin/cronolog eureka-$active-%Y-%m-%d.out >> /dev/null 2>&1 &  ##日志切割
    nohup java -jar $APP --spring.profiles.active=$active >> /dev/null & ##不保存启动日志
    
    echo "[$APP] start, ok!"
    }
    
    stop() {
    if [ -z "$pid" ]; then
    echo "[$APP] not running!"
    #return 0
    fi
    
    kill -9 $pid
    echo "[$APP] stop, ok!"
    }
    
    status() {
    if [ -z "$pid" ]; then
    echo "[$APP] not running!"
    else
    echo "[$APP] is running!"
    fi
    }
    
    case $1 in
    start)
    start
    ;;
    stop)
    stop
    ;;
    status)
    status
    ;;
    *)
    echo "Usage: {start|stop|status}"
    ;;
    esac
    
    exit 0
    

      

  • 相关阅读:
    FPM
    Docker记录
    阿里云ECS发送企业邮件
    git操作
    vscode+vagrant+xdebug调试
    Spring Security开发安全的REST服务
    559. Maximum Depth of N-ary Tree
    《算法图解》之散列表
    766. Toeplitz Matrix
    893. Groups of Special-Equivalent Strings
  • 原文地址:https://www.cnblogs.com/John5/p/11460703.html
Copyright © 2011-2022 走看看