solr死锁问题升级版脚本

#!/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.62
do
a=($(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 ]; then
for (( i=0;i<=${#a[@]};i++ ))
do
ssh ${g[i]} "mv ${a[i]} /tmp/solrerror"
echo ok
#/usr/local/resin/bin/resin.sh restart -server solr
sh /www/shell/syslog.sh ${g[i]}-solr-error-移走${a[i]} `hostname` 1 2 1
done
echo $a
fi
done

本文出自 “expect批量同步数据” 博客,转载请与作者联系!

你可能感兴趣的:(null)