Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The Shell script wants to check the error log from a minute ago.

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Demand:

The original script is to check the error log of a minute ago for statistical output.

The original script: [root@os1 opt] # cat live color segmentLost.shroud binder echo yy date = `date + "% Y-%m-%d% H15% M"-d "1 minutes ago" `cat / data/oslog/processor_log/vps_segmentLostInfoFile.log | grep "$date" | wc-l `Cat $yy [date] #

Question:

Found that there has been no statistics, manual execution of the script is also 0, enter the log file to check and find that there are error entries.

Found the problem: the log time format of the program output is CST time, and then check the operating system to find that it is UTC time, which is ridiculous.

Resolve the problem:

Modify the script:

[``root@os1 opt] # cat livecopyright segmentLost.shroud grep "$date" | wc-l `

Echo $yy

Replace the script in the file:

Sed-I "splash 1 minutes ago/479 minutes/g" live-segmentLost.sh

Sed-I "splash 1 minutes ago/479 minutes/g" ts-to-m4s.sh

Sed-I "splash 1 minutes ago/479 minutes/g" chaxunshujukuxiangyingshijian.sh

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report