多台日志汇聚一个terminal实例
2015-12-18 17:33
429 查看
#!/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"
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"
相关文章推荐
- java提高篇(十一)-----代码块
- Oracle、MySql、SQLServer 数据分页查询
- flume的配置
- 事件的解除与绑定
- Windows2008r2主域和从域传输的问题
- nginx的配置、虚拟主机、负债均衡和反向代理(2)
- 重启博客,继续开始个人的旅行
- IOS判断日期是今天,昨天还是明天
- 获得本月的第一天和最后一天
- java提高篇(十)-----强制类型转换
- linux 后台任务,screen命令
- 送给正在 奋斗和成长路上的女人们
- 第13周项目2-Kruskal算法的验证
- 用纯php实现MVC框架,文件目录模仿yii2
- Wix学习整理(4)——关于WiX文件格式和案例HelloWorld的分析
- 斯坦福机器学习课程笔记week2&3 线性/逻辑斯蒂回归
- iOS ble关键开发步骤
- ResourceBundle.getBundle
- Apache,nginx,tomcat比较(转载)
- java提高篇(九)-----详解匿名内部类