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

Get the alarm log within two days (AIX | ksh | shell | oracle)

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

#! / usr/bin/ksh

# author: Rui Zhang

# date: 2017-08-09

# email: sharpzhang_2008@126.com

Export LANG=en_US.UTF-8

Dir_name=/tmp/tday_log/

Log_name=/tmp/tday_log/tday_log_ `date +'% F'`

Log_name=/tmp/tday_log/10.4.57.129_tday_ `date +'% F'`. Log

Yday= `TZ = aaa24 date +'a% b% d '`

Tday= `date +'a b d '`

Yday_num= `TZ = aaa24 date +'% F'`

Tday_num= `date +'% F'`

Yday_md= `TZ = aaa24 date +'% m% d' `. * `TZ=aaa24 date +'% y``

Tday_md= `date +'% m% d' `. * `date +'% y``

Yday_lis= `TZ = aaa24 date +'% d-%b-%Y'| tr'[a murz]''[Amurz]'`

Tday_lis= `date +'% d-%b-%Y'| tr'[Amurz]'[Amurz]'`

If [!-d "$dir_name"]; then

Mkdir-p $dir_name

Fi

If [- f "$log_name"]; then

Rm-f $log_name

Fi

Echo "# # / var/log/messages##" > > $log_name

Echo "" > > $log_name

Echo "" > > $log_name

Errpt | head-1 > > $log_name

Errpt | egrep "${yday_md} | ${tday_md}" > > $log_name

# egrep "Jul\ 3 | Jul\ 2" / var/log/messages > > $log_name

Echo "" > > $log_name

Function chk_db_log {

File_name=$1

Count_1=0

While read line

Do

# count_1=$ [$count_1+1]

Let count_1+=1

Day_mid=$ (echo "$line" | egrep "${yday} | ${tday}")

If [[- n $day_mid]]; then

Break

Fi

Done = count_1); then

Echo "$line" > > $log_name

Fi

Done > $log_name

}

Function chk_grid_log {

File_name=$1

Count_1=0

While read line

Do

# count_1=$ [$count_1+1]

Let count_1+=1

Day_mid=$ (echo "$line" | egrep "${yday_num} | ${tday_num}")

If [[- n $day_mid]]; then

Break

Fi

# echo $line

# echo $count_1

# done > $log_name

Fi

# done $log_name

}

Function chk_listener_log {

File_name=$1

Count_1=0

While read line

Do

# count_1=$ [$count_1+1]

Let count_1+=1

Day_mid=$ (echo "$line" | egrep "${yday_lis} | ${tday_lis}")

If [[- n $day_mid]]; then

Break

Fi

# echo $line

# echo $count_1

# done > $log_name

Fi

# done $log_name

}

# echo $count_1

Echo "# # db_log##" > > $log_name

Echo "" > > $log_name

Echo "" > > $log_name

Chk_db_log / u01/app/oracle/diag/rdbms/ebiz/ebiz1/trace/alert_ebiz1.log

Echo "# # asm_log##" > > $log_name

Echo "" > > $log_name

Echo "" > > $log_name

Chk_db_log / u01/app/grid/diag/asm/+asm/+ASM1/trace/alert_+ASM1.log

Echo "# # grid_log##" > > $log_name

Echo "" > > $log_name

Echo "" > > $log_name

Chk_grid_log / u01/app/11.2.0.3/grid/log/ecpdb1/alertecpdb1.log

Echo "# listener_log##" > $log_name

Echo "" > > $log_name

Echo "" > > $log_name

# 11g##

Chk_grid_log / u01/app/grid/diag/tnslsnr/ecpdb1/listener/alert/log.xml

# 11g##

# 10g##

# chk_listener_log / u01/app/oracle/diag/tnslsnr/zhangr/listener/trace/listener.log

# 10g##

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