#!/bin/bash
echo $@
#tmp1=${tmp[*]}
function jkill() {
kill -9 $@
}
if [ $# -lt 1 ];then
ssh web@10.1.5.130 tail -f /data/web/tomcat/tomcat7-creditLoan/logs/catalina.out | awk '{print "10.1.5.130--"$0}' &
pid_1=$!
ssh web@10.1.5.131 tail -f /data/web/tomcat/tomcat7-creditLoan/logs/catalina.out |awk '{print "10.1.5.131--"$0}' &
pid_2=$!
ssh web@10.1.5.130 tail -f /data/web/tomcat/tomcat7-creditLoan-task/logs/catalina.out |awk '{print "10.1.5.130.1--"$0}' &
pid_3=$!
else
ssh web@10.1.5.130 tail -f /data/web/tomcat/tomcat7-creditLoan/logs/catalina.out | grep $@ |awk '{print "10.1.5.130--"$0}' &
pid_1=$!
ssh web@10.1.5.131 tail -f /data/web/tomcat/tomcat7-creditLoan/logs/catalina.out | grep $@ |awk '{print "10.1.5.131--"$0}' &
pid_2=$
ssh web@10.1.5.130 tail -f /data/web/tomcat/tomcat7-creditLoan-task/logs/catalina.out |grep $@ |awk '{print "10.1.5.130.1--"$0}' &
pid_3=$!
fi
trap "kill -9 ${pid_1} ${pid_2} ${pid_3};exit 0" SIGTERM SIGKILL SIGQUIT SIGSTOP SIGTSTP SIGCHLD SIGINT
while true;do
sleep 100
done
log.sh |grep "10.1.5.130"
log.sh|grep -v "10.1.5.130.1"