zoukankan      html  css  js  c++  java
  • Java 常规启动与关闭脚本

    【启动脚本】

    #!/bin/bash
    
    spirng_boot_opts="-Dspring.profiles.active=test"
    stdout_log=/data/app/mobile-gateway-biz/scripts/nohup.out
    start_cmd="java $spirng_boot_opts -Xms1g -Xmx1g -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=256m -XX:-UseBiasedLocking -XX:AutoBoxCacheMax=20000 -XX:+PerfDisableSharedMem -XX:+AlwaysPreTouch -Djava.security.egd=file:/dev/urandom -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+ExplicitGCInvokesConcurrent -XX:+ParallelRefProcEnabled -XX:+CMSParallelInitialMarkEnabled -Xloggc:/dev/shm/gc-mobile-service.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10m -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintPromotionFailure -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCID -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/logs/mobile-gateway-biz -XX:ErrorFile=/data/logs/mobile-gateway-biz/hs_err_pid%p.log -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8 -Djava.awt.headless=true -Duser.timezone=GMT -Dapollo.cacheDir=/data/apollo-cache/ -jar /data/app/mobile-gateway-biz/mobile-gateway-biz.jar > $stdout_log 2>&1 &"
    eval nohup "$start_cmd" &
    
    app='mobile-gateway-biz'
    pids=$(ps aux | grep -v grep | grep -v '/bin/bash' | grep java | grep ${app} | awk '{print $2}')
    if [ $?=0 ];then
      if [ "$pids" != "" ]; then
        echo "The service is restart sucessful!"
      fi
    else
        echo "The service is restart failed!Please check the start scripts!"
    fi

    【关闭脚本】

    #!/bin/bash
    
    app='mobile-gateway-biz'
    
    pids=$(ps aux | grep -v grep | grep -v '/bin/bash' | grep java | grep ${app} | awk '{print $2}')
    
    for pid in $pids; do
        kill -9 $pid
    done
    
    if [ "$pids" = "" ]; then
        echo "The service is stop sucessful!"
    else
       for pid in $pids; do
          kill -9 $pid > /dev/null 2>&1
          sleep 3
          echo "The service is stop sucessful!"
       done
    
    fi
  • 相关阅读:
    设计模式(观察者模式,MVC模式)
    设计模式(单例,委托模式)
    iOS API
    iOS介绍
    多种服饰颜色搭配
    国内npm镜像使用
    iOS开发拓展篇—应用之间的跳转和数据传
    iOS开发网络篇—使用ASI框架进行文件下载
    iOS开发网络篇—数据缓存(使用NSURLCache)
    iOS开发网络篇—发送json数据给服务器以及多值参数
  • 原文地址:https://www.cnblogs.com/NGU-PX/p/14156079.html
Copyright © 2011-2022 走看看