• Shell重启Tomcat脚本


    #!/bin/bash
    
    echo -e "
    
    
    "
    
    #force kill flag,if equal [f] to force kill all
    flag="HelloShell"
    if test $# -gt 0
    then
        flag=$1
    fi
    
    pids=`ps -ef|grep tomcat | grep -v "grep" | awk '{print $2}'`
    #pids=`ps -ef|grep -w tomcat | grep -v "grep" | awk '{print $2}'`
    
    count=0
    pid_num=0
    for pid in ${pids}
    do
        pid_num=${pid}
        count=`expr ${count} + 1`
    done
    
    if test $[count] -gt 1
    then
        if test $flag = "f"
        then
            for pid in ${pids}
            do
                echo "kill " ${pid}
                kill -9 ${pid}
            done
            echo "Force kill more progress success!"
        else
            echo "Exist more progress is running, Input param [f] to force kill."
        fi
    else
        if test $[count] -eq 1
        then
            kill -9 ${pid_num}
            echo "Kill " ${pid_num} " Success!"
        else
            echo "Clear!"
        fi
    fi
    
    # start
    bash /root/soft/apache-tomcat-7.0.90/bin/startup.sh
    
    
    
    echo -e "
    
    
    "
  • 相关阅读:
    隐式马尔科夫模型
    TCP与UDP协议
    语法分析
    requests发送HTTP请求
    IPv6协议
    IP协议
    路由协议
    Django表单验证
    PDB调试Python程序
    word2vec模型原理与实现
  • 原文地址:https://www.cnblogs.com/jonban/p/9695264.html
Copyright © 2020-2023  润新知