#!/bin/bash
b=`date +%H:%M`#c=`date +%H:%M -d "-10 min"`e=`date +%Y-%m-%d`d=`echo "$e\\ $b"|awk -F "" '{OFS=""}END{$NF=null;print}'`for i in 192.168.0.140 192.168.0.141 192.168.0.62doa=($(ssh $i "cat /www/backserver/logs/root-error.log|grep $d|grep "write.lock$"|awk -F "SimpleFSLock@" '{print "'$2'"}'|awk '{++a["'$0'"]}END{for ( i in a ) print i,a[i]}'|awk '{print $1}'"))f=`ssh $i "cat /www/backserver/logs/root-error.log|grep $d|grep "write.lock$"|awk -F "SimpleFSLock@" '{print "'$2'"}'|awk '{++a["'$0'"]}END{for ( i in a ) print i,a[i]}'|awk '{print $1}'"|wc -l`g=($(ssh $i "cat /www/backserver/logs/root-error.log|grep -A 2 "write.lock$" |awk 'END{print}'|awk -F "[/:]" '{print "'$5'"}'|awk '!a["'$0'"]++'"))if [ "$f" -gt 0 ]; thenfor (( i=0;i<=${#a[@]};i++ ))dossh ${g[i]} "mv ${a[i]} /tmp/solrerror"echo ok#/usr/local/resin/bin/resin.sh restart -server solrsh /www/shell/syslog.sh ${g[i]}-solr-error-移走${a[i]} `hostname` 1 2 1doneecho $afidone