• 启动脚本


    #!/bin/sh
    RESOURCE_NAME=atlas-oss-0.0.1-SNAPSHOT.jar
    
    tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
    if [ ${tpid} ]; then
    echo 'Stop Process...'
    kill -15 $tpid
    fi
    sleep 5
    tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
    if [ ${tpid} ]; then
    echo 'Kill Process!'
    kill -9 $tpid
    else
    echo 'Stop Success!'
    fi
    
    tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
    if [ ${tpid} ]; then
        echo 'atlas-oss is running.'
    else
        echo 'atlas-oss is NOT running.'
    fi
    
    rm -f tpid
    nohup java -jar $RESOURCE_NAME --spring.profiles.active=oss-dev &
    echo $! > tpid
    echo Start Success!

    升级版本

    #!/usr/bin/env bash
    
    binDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
    cd ${binDir} && cd ../
    curDir=`pwd`
    #binDir="$( cd $(dirname $0) && pwd )"
    #curDir="$( cd $(dirname $binDir); pwd )"
    packageName=${curDir##*/}
    moduleName=${packageName%-*}
    
    if [ ! -n "$PRO_PATH" ]; then
        export PRO_PATH="${curDir}"
    fi
    
    profiles=$2
    rootDir=${curDir}
    libPath=${rootDir}/lib
    libPathCustomize=${rootDir}/libcustomize
    sourcePath=${rootDir}/conf
    export logPath=${rootDir}/logs
    stopPath=${rootDir%-*}
    
    if [ ! -d ${logPath} ]; then
        mkdir -p ${logPath}
    fi
    
    start() {
        echo "start ${moduleName}..."
        nohup java -Dloader.path=${libPathCustomize},${libPath},${sourcePath} -XX:+UseConcMarkSweepGC 
        -DJM.LOG.PATH=${logPath} -DJM.SNAPSHOT.PATH=${sourcePath} 
        -Xmx2048m -Xms2048m -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:${logPath}/java_gc.log 
        -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Duser.timezone=Asia/Shanghai 
        -XX:-HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${logPath} -jar ${libPath}/${packageName}.jar 
        --spring.profiles.active=${profiles} --isJar=true > /dev/null 2>&1 &
    }
    
    stop() {
        pid=`ps -ef | grep ${stopPath} | grep -v grep | awk '{print $2}'`
        echo "stop ${moduleName}..."
        if [ -n "${pid}" ]
        then
            kill -9 $pid
        fi
    }
    
    restart() {
        stop
        start
    }
    
    case "$1" in
        start|stop|restart)
              case "$2" in
                  haizhi|test|uat)
                      $1
                      ;;
                  *)
                      echo $"Usage: $0 {start|stop|restart} {haizhi|test|uat}"
                      exit 2
              esac
            ;;
        *)
            echo $"Usage: $0 {start|stop|restart}"
            exit 1
    esac
  • 相关阅读:
    JWT(json web token)--.JwtBearer jwt
    NET LOG日志的使用以及设置文件大小和数量限制
    Xshell、MobaXterm等5款主流SSH客户端对比
    RabbitMQ使用交换机处理异步消息队列------发布与订阅
    RabbitMQ使用交换机处理异步消息队列------分布式事务处理案例
    RabbitMQ使用交换机处理异步消息队列案例
    SqlServer Microsoft SQL Server 2005 使用复制(发布、订阅)的方式使主从数据库同步
    Hangfire-执行定时任务框架
    Catalina 默认使用zsh了,你可习惯
    你几点睡,就是什么命
  • 原文地址:https://www.cnblogs.com/yadongliang/p/13955240.html
一二三 - 开发者的网上家园