• Linux上java程序的jar包启动通用脚本(稳定用过)


    Linux上java程序的jar包启动通用脚本如下:

    #! /bin/sh
    
    export LANG="zh_CN.GBK"
    
    SERVICE_NAME=`basename $0 .sh`
    SCRIPT_NAME=`basename $0`
    EXEC_JAR_NAME=$SVC_PGW_BIN_PATH/job-pbc-bat/job-pbc-bat-test-2.00.00.jar
    JAVA_CMD="java  -Djsvc-pgw-name="${SERVICE_NAME}" 
                    -Xmx1024m  
            -Xms512m 
            -Xmn128m  
            -XX:MaxPermSize=128m  
            -XX:SurvivorRatio=14  
            -XX:-UseParallelGC  
            -XX:+UseParallelOldGC
                    -XX:ParallelGCThreads=8 
                    -XX:+DisableExplicitGC
                    -Dencoding=gbk
            -classpath ${EXEC_JAR_NAME}:${SVC_PGW_BIN_PATH}/job-eup-wy/config:${SVC_PGW_ENGINE_PATH}/svc-pgw-engine-1.0.jar
            -Djava.ext.dirs="${JAVA_HOME}/jre/lib/ext"
                  -Djsvc.pgw.log.path=$SVC_PGW_LOG_PATH 
                  cn.com.bestpay.pgw.pbcbat.handler.JobPbcBootStrap"
    
     
    
    start()
    {
          echo starting the $SERVICE_NAME service......
          SERVICE_PID=`ps -ef | grep java | grep $SERVICE_NAME | awk '{print $2}'`
          if [ ! $SERVICE_PID ]; then
        $JAVA_CMD &
             echo $SERVICE_NAME started!
          else
             echo $SERVICE_NAME had been started
          fi 
    }
    
    stop()
    {
           echo Stopping the $SERVICE_NAME service......
           SERVICE_PID=`ps -ef | grep java | grep $SERVICE_NAME | awk '{print $2}'`
           if [ ! $SERVICE_PID ]; then
              echo $SERVICE_NAME had been stopped!
           else
              kill -9 $SERVICE_PID
              echo $SERVICE_NAME stopped!
           fi 
    
    }
    
    restart()
    {
           echo Restarting the $SERVICE_NAME service......
           SERVICE_PID=`ps -ef | grep java | grep $SERVICE_NAME | awk '{print $2}'`
           if [ ! $SERVICE_PID ]; then
                   $JAVA_CMD  &
          echo $SERVICE_NAME restarted!
           else
              kill -9 $SERVICE_PID
               $JAVA_CMD &
              echo $SERVICE_NAME stopped!
          echo $SERVICE_NAME restarted!
           fi
    }
    
    case "$1" in
     start)
           start
           ;;
     stop)
           stop
           ;;
     restart)
           restart
           ;;
     *)
           echo "Usage: $SCRIPT_NAME {start|stop|restart}" >&2
           exit 1
           ;;
    esac
    
    exit 0

    代码仅供参考,使用时有些环境变量需要根据实际情况修改。

  • 相关阅读:
    表单
    表格的应用
    图像与超链接
    HTML基础(部分标签的应用)
    DataFrame合并数据df.append
    DataFrame处理接口返回数据
    pandas读取excel文件
    数据加载、存储于文件格式:二进制数据格式pickle
    AttributeError: 'DataFrame' object has no attribute 'save'
    web信息收集:获取所有url
  • 原文地址:https://www.cnblogs.com/alsodzy/p/8527289.html
Copyright © 2020-2023  润新知