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
    

      

  • 相关阅读:
    触摸事件传递与响应者链条
    运动事件Motion Events
    手势识别
    MVC模式
    单例模式
    观察者模式(一对多)
    关于多线程的介绍
    Sandbox简介和路径获取
    NSFileManager和NSFileHandle使用
    归档储存
  • 原文地址:https://www.cnblogs.com/John5/p/11460703.html
Copyright © 2011-2022 走看看