• springboot项目简单启动脚本


    #!/bin/bash
    
    function log_info () { 
    DATE=`date "+%Y-%m-%d %H:%M:%S"`
    USER=$(whoami)
    echo "${DATE} ${USER} execute $0 [INFO] $@"
    }
    
    function log_error () 
    { 
    DATE=`date "+%Y-%m-%d %H:%M:%S"`
    USER=$(whoami)
    echo "${DATE} ${USER} execute $0 [ERROR] $@"
    }
    
    function fn_log () 
    { 
    if [ $? -eq 0 ]; then 
    	log_info "$@ sucessed!"
    else 
    	log_error "$@ failed!"
    	exit 
    fi 
    }
    
    # cd 51token
    # git pull
    # cd token-api
    # get pid
    # kill pid
    # mvn clean package
    # cd target
    # nohup java -jar ... >/dev/null &
    
    APP="token-api-0.0.1-SNAPSHOT.jar"
    
    cd ~/51token
    
    git pull
    fn_log "git pull"
    
    sleep 3
    
    cd token-api
    
    PID=`ps -C java -f | grep $APP | awk '{print $2}'`
    fn_log "ps -C java -f | grep $APP | awk '{print $2}"
    
    if [ -n "$PID" ]; then
    	kill 9 $PID
    	fn_log "kill 9 $PID"
    fi
    
    sleep 2
    
    mvn clean package
    fn_log "mvn clean package"
    
    sleep 5
    
    cd target
    if [ -f "$APP" ]; then
    	nohup java -jar $APP >/dev/null &
    	fn_log "nohup java -jar $APP >/dev/null &"
    else
    	echo "package not exist"
    	exit
    fi
    
    ss -tlnp
    
    COUNT=15
    while [ $COUNT -gt 0 ]; do
            echo "wait"
            COUNT=`expr $COUNT "-" 1`
            sleep 1
    done
    
    ss -tlnp
    

      

  • 相关阅读:
    spring小结2:spring管理bean原理(转帖)
    JAVA Web.xml 加载顺序
    mysql into outfile导出方式
    从平安面试归来
    如何避开求职陷阱
    关注基金走势先~~
    如何谈薪资
    包含数据分析的坐标图测试
    面试题分享
    ShaiShai.net
  • 原文地址:https://www.cnblogs.com/tq1226112215/p/9395810.html
Copyright © 2020-2023  润新知