1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| #!/bin/bash
export JAVA_HOME=/local/server/1.6.0_38 export CLASSPATH=$JAVA_HOME/lib/ export PATH=$PATH:$JAVA_HOME/bin export PATH JAVA_HOME CLASSPATH
tomcat_path1=/local/server/tomcat_UserLoginSys_7771 tomcat_path2=/local/server/tomcat_wx_manage_18050 tomcat_path3=/local/server/tomcat_InstantClient_7781 tomcat_path4=/local/server/tomcat_weixinzhcw_8040 tomcat_path5=/local/server/tomcat_zhcwwxweb_8030
date=$(date +%Y-%m-%d-%k:%M:%S)
tomcat_UserLoginSys_7771=`ps -ef|grep tomcat_UserLoginSys_7771 |grep -v grep|wc -l` tomcat_wx_manage_18050=`ps -ef|grep tomcat_wx_manage_18050 |grep -v grep|wc -l` tomcat_InstantClient_7781=`ps -ef|grep tomcat_InstantClient_7781 |grep -v grep|wc -l` tomcat_weixinzhcw_8040=`ps -ef|grep tomcat_weixinzhcw_8040 |grep -v grep|wc -l` tomcat_zhcwwxweb_8030=`ps -ef|grep tomcat_zhcwwxweb_8030 |grep -v grep|wc -l`
if [ $tomcat_UserLoginSys_7771 -eq 0 ] then nohup ${tomcat_path1}/bin/startup.sh > /dev/null 2>&1 & echo "${date} tomcat_UserLoginSys_7771已重启" >> /local/script/restart.log fi
if [ $tomcat_wx_manage_18050 -eq 0 ] then nohup ${tomcat_path2}/bin/startup.sh > /dev/null 2>&1 & echo "${date} tomcat_wx_manage_18050已重启" >> /local/script/restart.log fi
if [ $tomcat_InstantClient_7781 -eq 0 ] then nohup ${tomcat_path3}/bin/startup.sh > /dev/null 2>&1 & echo "${date} tomcat_InstantClient_7781已重启" >> /local/script/restart.log fi
if [ $tomcat_weixinzhcw_8040 -eq 0 ] then nohup ${tomcat_path4}/bin/startup.sh > /dev/null 2>&1 & echo "${date} tomcat_weixinzhcw_8040已重启" >> /local/script/restart.log fi
if [ $tomcat_zhcwwxweb_8030 -eq 0 ] then nohup ${tomcat_path5}/bin/startup.sh > /dev/null 2>&1 & echo "${date} tomcat_zhcwwxweb_8030已重启" >> /local/script/restart.log fi
|