• run.sh


    1.run.sh   文件  ./run.sh start启动    ./run.sh stop 停止    ./run.sh restart重启     ./run.sh install安装        ./run.sh uninstall卸载

    #!/bin/bash
    ### BEGIN INIT INFO 
    # Provides: Nginx
    # Required-Start: $all 
    # Required-Stop: $all 
    # Default-Start: 3 5 
    # Default-Stop: 0 1 6 
    # Short-Description: Start and stop nginx mode 
    # Description: Start and stop nginx in external FASTCGI mode 
    ### END INIT INFO 
    # chkconfig: 2345 90 10
    # description: nginx server daemon
    
    dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
    
    install()
    {
    echo "pass"
    }
    
    uninstall()
    {
    echo "pass"
    }
    
    start()
    {
    #port=$(grep server.port= application.properties |awk -F '=' '{printf $2}')
    pid=$(ps -ef|grep $dir/package-all.jar|grep -v grep |awk '{printf $2}')
    if [[ -n "$pid" ]];  then
      echo "$dir/package-all.jar is alredy running"
      exit 0
    else
      nohup java -jar -Dspring.config.location=config/application.properties $dir/package-all.jar >/dev/null 2>&1 &
      exit 0
    fi
    }
    
    
    stop()
    {
    pid=$(ps -ef|grep $dir/package-all.jar|grep -v grep |awk '{printf $2}')
    if [[ -n "$pid" ]];  then
      kill -9 $pid
      exit 0
    fi
    }
    
    restart()
    {
    stop
    start
    }
    
    case $1 in
        'install')
           install
        ;;
        'uninstall')
           uninstall
        ;;
        'start')
           start
        ;;
        'stop')
           stop
        ;;
        'restart')
            restart
        ;;
        *)
        echo "Usage: $0 {install | uninstall | start | stop | restart}"
        exit 2
        ;;
    esac
    View Code
  • 相关阅读:
    HDU 1097 a hard puzzle
    HDU 4588 Count The Carries
    不想用锐捷怎么办?锐捷出问题|锐捷不能用怎么办?用menohust代替吧
    线段树及其变种的相关资料(不定期更新)
    UVa 10075
    UVa 1301
    UVa 10256
    UVa 1453
    计算几何相关资料+题目推荐(不定期补充)
    UVa 11524
  • 原文地址:https://www.cnblogs.com/jinnian18sui/p/10558840.html
Copyright © 2020-2023  润新知