zoukankan      html  css  js  c++  java
  • linux下的启停脚本

    linux下的根据项目名称,进行进程的启停脚本

    #!/bin/bash
    
    JAVA=/usr/bin/java
    APP_HOME=/opt/program/qa/wechat
    APP_NAME=programname.jar
    APP_PARAM="--spring.config.location=${APP_HOME}/application.properties --logging.path=${APP_HOME}"
    
    case $1 in
    start)
    PID=$(ps -ef | grep ${APP_NAME} | grep -v grep | awk '{print $2}')
    if [ -z "$PID" ] ;then
            echo "start ${APP_NAME}"
            nohup ${JAVA} -Dfile.encoding=utf-8  -jar ${APP_HOME}/${APP_NAME} ${APP_PARAM}  > /dev/null 2>&1  &
    else
            echo "${APP_NAME} is running"
    fi
    ;;
    
    stop)
    PID=$(ps -ef | grep ${APP_NAME} | grep -v grep | awk '{print $2}')
    if [ -z "$PID" ] ;then
            echo "${APP_NAME} is not running"
    else
            echo "stop ${APP_NAME}"
            kill -9 $PID
    fi
    ;;
    
    restart)
    PID=$(ps -ef | grep ${APP_NAME} | grep -v grep | awk '{print $2}')
    if [ -z "$PID" ] ;then
            echo "start ${APP_NAME}"
            nohup ${JAVA} -Dfile.encoding=utf-8  -jar ${APP_HOME}/${APP_NAME} ${APP_PARAM}   > /dev/null 2>&1  &
    else
            echo "stop ${APP_NAME}"
            kill -9 $PID
            echo "start ${APP_NAME}"
            nohup ${JAVA} -Dfile.encoding=utf-8  -jar ${APP_HOME}/${APP_NAME} ${APP_PARAM}   > /dev/null 2>&1  &
    fi
    ;;
    
    logs)
    tail -f ${APP_HOME}/catalina.out
    ;;
    
    status)
    PID=$(ps -ef | grep ${APP_NAME} | grep -v grep | awk '{print $2}')
    if [ -z "$PID" ] ;then
            echo "${APP_NAME} is not running"
    else
            echo "${APP_NAME} is running, pid $PID"
    fi
    ;;
    
    esac
    

      

  • 相关阅读:
    定时器工厂
    无聊js画了个菱形
    盒模型之滚动条
    无聊,纯css写了个评分鼠标移入的效果
    json属性名为什么要双引号?
    原生js写的一个简单slider
    D2 前端技术论坛总结(上)
    第一天,入坑 —— 2014.10.24
    获取div相对文档的位置
    我们平时是怎么写html和css的?
  • 原文地址:https://www.cnblogs.com/qianjinyan/p/10788808.html
Copyright © 2011-2022 走看看