当前位置:网站首页>Bash summary online log
Bash summary online log
2022-06-29 15:12:00 【Daiyuanpei】
#!/bin/bash
# date
if [ ! $1 ]; then
echo -e ' Date required , Examples :20220620'
exit;
fi
date=$1
# Total log file
logFile='/home/work/errorlog/error_'$date'.log'
# user
user='daiyuanpei'
# Delete the original log general act
rm -rf $logFile
# Get the... Of all machines ip And serial number
iplist=`get_instance_by_cloudapp -io projectName.pay`
#for The delimiter of is set to newline , It was originally a space and a newline
IFS=$'\n'
# Cycle all machines
for i in $iplist
do
# Get... For each machine ip And serial number
ip=`echo $i | awk '{print $2}'`;
offset=`echo $i | awk '{print $3}'`;
eachLogFile='/home/work/errorlog/log_'$offset'.log'
#scp hold log Copy the file
scp [email protected]$ip:/home/work/project-name/logs/$date/error.log $eachLogFile
# Judge that if it is not a file, it will jump out of this cycle
if [ ! -f "/home/work/errorlog/log_$offset.log" ];then
continue
fi
# Import each log into the total log
awk -v fileno=${offset} '{print fileno,"--",$0}' $eachLogFile >> $logFile
# Delete each small log file
rm -rf $eachLogFile
done边栏推荐
- Lumiprobe reactive dye miscellaneous dye: BDP FL ceramide
- How word automatically generates directories
- 三角函数对应在平面坐标上画圆
- How bad can a programmer be?
- Yi Ming ang Ke rushed to Hong Kong shares: loss of 730million in the year Lilly and sunshine life insurance were shareholders
- render后续来了,封装一个表单往表格中添加数据
- 华为软件测试笔试真题之变态逻辑推理题【二】华为爆火面试题
- Huashu high tech rushes to the scientific innovation board: the actual controller xuxiaoshu and his son, who plan to raise 660million yuan, are both American nationals
- Slow bear market, bit Store provides stable stacking products to help you cross the bull and bear
- 卫星运动的微分方程
猜你喜欢

Is 100W data table faster than 1000W data table query in MySQL?

Imitation headline news information DZ template discuz news information business version GBK template source code

三角函数对应在平面坐标上画圆

他山之石 | 丁香园 医疗领域图谱的构建与应用

Informatics Olympiad all in one 1194: mobile route

Unity C# 基础复习28——带返回的委托(P449)

Lumiprobe reactive dye miscellaneous dye: BDP FL ceramide

信息学奥赛一本通2061:梯形面积

熊市慢慢,Bit.Store提供稳定Staking产品助你穿越牛熊

华曙高科冲刺科创板:拟募资6.6亿 实控人许小曙父子均为美国籍
随机推荐
文本预处理库spaCy的基本使用(快速入门)
Netease strict selection offline data warehouse quality construction practice
Informatics Olympiad 1001:hello, world!
phpcms打开后台首页时向官网发送升级请求觉得卡怎么办?
Construction and application of medical field Atlas of dingxiangyuan
西北工业大学遭境外电邮攻击
第九章 APP项目测试(4) 测试工具
Draw a slash on a plane coordinate
Is 100W data table faster than 1000W data table query in MySQL?
信息学奥赛一本通1002:输出第二个整数
Abnormal logic reasoning problem of Huawei software test written test [2] Huawei hot interview problem
信息学奥赛一本通1001:Hello,World!
kubernetes Unable to connect to the server: x509: certificate has expired or is not yet valid
Solution to the problem that the assembly drawing cannot be recognized after the storage position of SolidWorks part drawing is changed
JS will have variable promotion and function promotion
Trigonometric function corresponding to drawing circle on plane coordinate
What should phpcms do when it sends an upgrade request to the official website when it opens the background home page?
const用法精讲
Hi, you have a code review strategy to check
Illustration of Ctrip quarterly report: net revenue of RMB 4.1 billion has been "halved" compared with that before the outbreak