recovery.sh

#!/bin/bash

source /etc/profile

Time=`date +%F-%H-%M`

Dir=/data/any.service.recovery

if [ ! -d $Dir ];then
mkdir -p $Dir
fi


###tomcat8080
#curl http://127.0.0.1:8080/ping/anno &>/dev/null
#if [ $? != 0 ];then
# pid=`ps -ef|grep apache-tomcat-8.0.45-signature |grep data |awk '{print $2}'`
# ps -ef|grep apache-tomcat-8.0.45-signature |grep data
# [ $? = 0 ] && kill -9 $pid
# /data/apache-tomcat-8.0.45-signature/bin/startup.sh &>/dev/null
# echo $Time apache-tomcat-8.0.45-signature was started >> $Dir/tomcat-log
#fi

##tomcat8180
curl http://127.0.0.1:8180/ping/anno &>/dev/null
if [ $? != 0 ];then
pid=`ps -ef|grep tomcat-loan-8180 |grep data |awk '{print $2}'`
ps -ef|grep tomcat-loan-8180 |grep data
[ $? = 0 ] && kill -9 $pid
/data/tomcat-loan-8180/bin/startup.sh &>/dev/null
echo $Time tomcat-loan-8180 has been started >> $Dir/tomcat-log
sh /data/any.service.recovery/weixin.sh LeiYong 1000002 "主机pro-oms-finance-loan-manager-02:tomcat-loan-8180 检测到服务不可用,成功进行重启"
fi

###tomcat8280
#curl http://127.0.0.1:8280/ping/anno &>/dev/null
#if [ $? != 0 ];then
# pid=`ps -ef|grep tomcat-finance-8280 |grep data |awk '{print $2}'`
# ps -ef|grep tomcat-finance-8280 |grep data
# [ $? = 0 ] && kill -9 $pid
# /data/tomcat-finance-8280/bin/startup.sh &>/dev/null
# echo $Time tomcat-finance-8280 has been started >> $Dir/tomcat-log
# sh /data/any.service.recovery/weixin.sh LeiYong 1000002 "tomcat-finace-8280-01 has been started"
#fi

##tomcat8380
curl http://127.0.0.1:8380/ping/anno &>/dev/null
if [ $? != 0 ];then
pid=`ps -ef|grep tomcat-manager-8380 |grep data |awk '{print $2}'`
ps -ef|grep tomcat-manager-8380 |grep data
[ $? = 0 ] && kill -9 $pid
/data/tomcat-manager-8380/bin/startup.sh &>/dev/null
echo $Time tomcat-manager-8280 has been started >> $Dir/tomcat-log
sh /data/any.service.recovery/weixin.sh LeiYong 1000002 "主机pro-oms-finance-loan-manager-02:tomcat-manager-8380 检测到服务不可用,成功进行重启"
fi

###tomcat8480
#curl http://127.0.0.1:8480/ping/anno &>/dev/null
#if [ $? != 0 ];then
# pid=`ps -ef|grep tomcat-app-8480 |grep data |awk '{print $2}'`
# ps -ef|grep tomcat-app-8480 |grep data
# [ $? = 0 ] && kill -9 $pid
# /data/tomcat-app-8480/bin/startup.sh &>/dev/null
# echo $Time tomcat-app-8480 has been started >> $Dir/tomcat-log
# sh /data/scripts/weixin.sh LeiYong 1000002 "tomcat-app-8480-02 has been started"
#fi

###apache-tomcat-diamond
#ps -ef|grep apache-tomcat-diamond |grep data
#if [ $? != 0 ];then
# /data/apache-tomcat-diamond/bin/startup.sh &>/dev/null
# echo $Time apache-tomcat-diamond was started >> $Dir/diamond-log
#fi

###apache-tomcat-dubboConsole
#ps -ef|grep apache-tomcat-dubboConsole |grep data
#if [ $? != 0 ];then
# /data/apache-tomcat-dubboConsole/bin/startup.sh &>/dev/null
# echo $Time apache-tomcat-dubboConsole was started >> $Dir/dubboConsole-log
#fi

###apache-tomcat-XXL
#ps -ef|grep apache-tomcat-XXL |grep data
#if [ $? != 0 ];then
# /data/apache-tomcat-XXL/bin/startup.sh &>/dev/null
# echo $Time apache-tomcat-XXL was started >> $Dir/XXL-log
#fi

##firewall
/sbin/service iptables status &>/dev/null
if [ $? != 0 ];then
/sbin/service iptables start &>/dev/null
echo $Time firewall has been started >> $Dir/firewall-log
fi

###redis
#ps -ef|grep redis |grep server &>/dev/null
#if [ $? != 0 ];then
# /data/middle/redis/bin/redis-server /data/middle/redis/conf/redis_11002.conf
# /data/middle/redis/bin/redis-server /data/middle/redis/conf/redis_11003.conf
# /data/middle/redis/bin/redis-server /data/middle/redis/conf/redis_11004.conf
# echo $Time redis was started >> $Dir/redis-server-log
#fi
#ps -ef|grep redis |grep sentinel &>/dev/null
#if [ $? != 0 ];then
# /data/middle/redis/bin/redis-sentinel /data/middle/redis/conf/sentinel_26379.conf
# /data/middle/redis/bin/redis-sentinel /data/middle/redis/conf/sentinel_36379.conf
# /data/middle/redis/bin/redis-sentinel /data/middle/redis/conf/sentinel_46379.conf
# echo $Time redis was started >> $Dir/redis-sentinel-log
#fi

###zookeeper
#ps -ef|grep zookeeper |grep data
#if [ $? != 0 ];then
# sh /data/middle/zookeeper/zk-1/bin/zkServer.sh start &>/dev/null
# sh /data/middle/zookeeper/zk-2/bin/zkServer.sh start &>/dev/null
# sh /data/middle/zookeeper/zk-3/bin/zkServer.sh start &>/dev/null
# echo $Time zookeeper was started >> $Dir/zookeeper-log
#fi

上一篇:一个关于VTS VtsKernelCheckpointTest、VtsKernelCheckpointTest测项失败的代码分析


下一篇:SQL SERVER 日志文件过大导致磁盘空间不足产生错误:事务日志已满,起因为"LOG_BACKUP"。