zoukankan      html  css  js  c++  java
  • Java jar包启动脚本

    #!/bin/bash
    APP_HOME=/wdcloud/app/rps/rps-module-admin
    APP_JAR=rps-module-admin-*.jar
    APP_PIDS=$(ps ax | grep java | grep $APP_HOME | grep -v grep | awk '{print $1}')
    
    function start(){
    	if [ -z "$APP_PIDS" ]; then
    		echo "start project..."
    		exec java -jar $APP_HOME/$APP_JAR  >/dev/null 2>&1 &
    		echo "start project end..."
    	else
    		echo "warning: the spring boot server is started!!!====="$APP_HOME
    		exit 1
    	fi
    }
    
    function stop(){
    	if [ -z "$APP_PIDS" ]; then
    		echo "No spring boot server to stop"
    	else
    		echo "stop project..."
    		kill -s TERM $APP_PIDS
    		echo "stop project end..."
    	fi
    }
    
    
    function restart(){
        stop
        sleep 3
    	APP_PIDS=$(ps ax | grep java | grep $APP_HOME | grep -v grep | awk '{print $1}')
        start
    }
    
    case "$1" in
        start)  
        start
        ;;
        stop)
        stop
        ;;
        restart)
        restart
        ;;
        *)  
        printf 'Usage: %s {start|stop|restart}
    ' "$prog"
        ;;
    esac
    exit 1
    
    
  • 相关阅读:
    2020.11.21日记
    Miller-Rabin质数测试
    Deepin配置记录
    shell
    module load
    vma
    DRDI
    Android.mk
    AEE
    阿里云下配置二级域名的解析设置
  • 原文地址:https://www.cnblogs.com/zhucww/p/10751500.html
Copyright © 2011-2022 走看看