zoukankan      html  css  js  c++  java
  • 服务启动脚本start_boot.sh

    vim start_boot.sh

    #!/bin/bash

    usage(){
    echo "$0 [start|stop|usage]"
    }

    status_springboot(){
    ps axu | grep "${jar_file}" | grep -v 'grep'
    }
    start_springboot(){
    echo "springboot start"
    #if [ `hostname` = "${jar_menu}01"  ]
    #then
    nohup java -server -Xmx${MEM_SIZE}m -Xms${MEM_SIZE}m  -Dio.netty.leakDetection.level=advanced -XX:+UseG1GC -XX:MaxGCPauseMillis=100 -jar ${jar_file} > /dev/null 2>&1 &
    #else
    nohup java -server -Xmx${MEM_SIZE}m -Xms${MEM_SIZE}m  -Dio.netty.leakDetection.level=advanced -XX:+UseG1GC -XX:MaxGCPauseMillis=100  -jar ${jar_file} > /dev/null 2>&1 &
    #fi
    }

    stop_springboot(){
    springboot_pid=` ps axu | grep "${jar_file}" | grep -v 'grep' | awk '{print $2}'`
    kill -9 $springboot_pid
    sleep 5;
    TSTAT=$(ps axu | grep "${jar_file}" | grep -v 'grep' | awk '{print $2}')
    if [ -z $TSTAT ];then
    echo "springboot stop"
    else
    kill -9 $TSTAT
    fi
    }

    function main(){

    jar_menu=`hostname | cut -d"0" -f1`
    [ -d /data/work/${jar_menu} ] || { echo -e "menu is not exist";exit 2; }
    data_path="/data/work/${jar_menu}"
    cd ${data_path}
    jar_file=`ls -lrt *.jar | tail -1 | awk '{print $9}'`

    #############judge jvm memory#######
    total_memory=$(vmstat -s -S M|awk 'NR==1{print $1}')
    avi_mem_size=$((${total_memory}/1024))
    if [ ${avi_mem_size} -gt 6 ];then
    MEM_SIZE="4096"
    elif [ ${avi_mem_size} -le 4 ];then
    MEM_SIZE="2048"
    fi
    echo ${MEM_SIZE}
    case $1 in

    start)
    start_springboot
    ;;
    stop)
    stop_springboot
    ;;
    status)
    status_springboot
    ;;
    restart)
    stop_springboot
    sleep 5
    start_springboot
    ;;
    *)
    usage
    ;;
    esac

    }
    main $1

  • 相关阅读:
    uC/OS-II内核的服务文件
    uC/OS-II汇编代码
    uC/OS-II类型定义
    uC/OS-II核心(Os_core)块
    uC/OS-II配置文件
    uC/OS-II应用程序exe
    uC/OS-II应用程序代码
    技术人员如何创业《四》- 打造超强执行力团队(转载)
    最近做抽奖的活动
    install docker
  • 原文地址:https://www.cnblogs.com/wangyh702/p/11492316.html
Copyright © 2011-2022 走看看