zoukankan      html  css  js  c++  java
  • 监控Tomcat并启动

     
    #!/bin/sh   
    export _JAVA_SR_SIGNUM=12   
    export JAVA_HOME=/usr/java/jdk1.6.0_11   
    export CATALINA_BASE=/home/co_newest_family/tomcat   
    export CATALINA_HOME=/usr/local/apache-tomcat-6.0.18   
    export LD_LIBRARY_PATH=:/usr/local/lib/:/usr/local/apr/lib/:/usr/local/apr/lib/   
    export CATALINA_OPTS="-server -Xms1024m -Xmx2048m -XX:PermSize=128m -XX:MaxPermSize=128m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9158 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dfile.encoding=UTF8 -Dmeganotes.home=/home/co_newest_family"   
    export PATH=$JAVA_HOME/bin:$PATH:$HOME/bin   
     
    date=`date "+%H:%M:%S"`   
    message="$date|check_tomcat(81_co_newest_family)_shutdown_and_restart_it."   
    request_url="http://10.27.5.81:9091/index.jsp"   
    
    if ! wget -t1 -T2 $request_url &> /dev/null;then   
    #pid=`ps aux | grep "-Dcms4.home=/home/co_newest_family/"| awk '{print $2}'`           
    #kill -9 $pid   
    ps x|grep 'tomcat'|grep -v 'grep'|grep -v 'sh'|awk '{print $1}'|xargs kill -9   
    $CATALINA_HOME/bin/startup.sh   
    wget -t1 -T2 http://10.27.5.112:8880/send.jsp?msg=$message &> /dev/null;   
    echo "$date check tomcat shutdown and restart it." >> logs/check.log   
    else   
    echo "$date check tomcat ok." >> logs/check.log   
    fi   
     
    rm -f index.jsp*   
    rm -f send.jsp?msg=*
  • 相关阅读:
    AMQP协议
    设计模式三:行为型模式
    设计模式二:结构型模式
    设计模式一:创建型模式
    算法进阶
    数据结构
    希尔排序、计数排序、桶排序、基数排序
    归并排序
    python Gevent协程
    python——多进程
  • 原文地址:https://www.cnblogs.com/Rainbow-G/p/4080044.html
Copyright © 2011-2022 走看看