我在公司写的第一个正式脚本
时间:2007-10-12 来源:codfei
[root@FX-DATABASE logs]# cat yupf.sh
#!/bin/bash
#make by rsec.yupf--codfei
cat /jhfapp/app/logs/$1 |awk -F"[" '{print $2}'|grep '^order'|awk -F"=" '{print $2}'|awk -F"," '{print $1}'> /tmp/orderid
#orderid=`while read i; do cat /jhfapp/app/logs/$1 |grep $i -A3 -B3 && echo '=================================== \n'; done < /tmp/orderid`
for i in `cat /tmp/orderid`
do
echo "**********************************************************************************************************************************"
echo "";
echo "==========================================$i begin ==============================================================";
#_customer=`cat /jhfapp/app/logs/$1|grep "$i" |awk -F'customerId =' '{print $2}' |awk -F, '{print $1}'`
#cat /jhfapp/app/logs/$1 |grep $_customer
cat /jhfapp/app/logs/$1 |grep $i -A3 -B3
echo "==========================================$i end ==============================================================";
echo "";
ssh 10.15.2.20 "cd /jhfapp/app/trader/trader/logs/ && grep -r '$i' ./"
#ssh 10.15.2.20 "grep -r '$orderid' /jhfapp/app/trader/trader/logs/"
echo "**********************************************************************************************************************************"
echo "";
echo "";
sleep 2
done
#!/bin/bash
#make by rsec.yupf--codfei
cat /jhfapp/app/logs/$1 |awk -F"[" '{print $2}'|grep '^order'|awk -F"=" '{print $2}'|awk -F"," '{print $1}'> /tmp/orderid
#orderid=`while read i; do cat /jhfapp/app/logs/$1 |grep $i -A3 -B3 && echo '=================================== \n'; done < /tmp/orderid`
for i in `cat /tmp/orderid`
do
echo "**********************************************************************************************************************************"
echo "";
echo "==========================================$i begin ==============================================================";
#_customer=`cat /jhfapp/app/logs/$1|grep "$i" |awk -F'customerId =' '{print $2}' |awk -F, '{print $1}'`
#cat /jhfapp/app/logs/$1 |grep $_customer
cat /jhfapp/app/logs/$1 |grep $i -A3 -B3
echo "==========================================$i end ==============================================================";
echo "";
ssh 10.15.2.20 "cd /jhfapp/app/trader/trader/logs/ && grep -r '$i' ./"
#ssh 10.15.2.20 "grep -r '$orderid' /jhfapp/app/trader/trader/logs/"
echo "**********************************************************************************************************************************"
echo "";
echo "";
sleep 2
done
相关阅读 更多 +