dede网站模板 音响,导购网站 模板,网站的开发建设要做什么的,ios注册开发者账号【Shell脚本】根据起止日期获取Alert日志内容 根据输入的起止日期字符串#xff0c;检索Oracle告警日志#xff0c;打印中间的日志行内容。
#!/bin/bash
# $1 START_TIME_STR, e.g. Oct 17 07:
# $2 END_TIME_STR, e.g. Oct 17 08:
source /home/o… 【Shell脚本】根据起止日期获取Alert日志内容 根据输入的起止日期字符串检索Oracle告警日志打印中间的日志行内容。
#!/bin/bash
# $1 START_TIME_STR, e.g. Oct 17 07:
# $2 END_TIME_STR, e.g. Oct 17 08:
source /home/oracle/.bash_profile
FILEPATH$ORACLE_BASE/diag/rdbms/hostname/${ORACLE_SID}/trace/alert_${ORACLE_SID}.logretrieveLog()
{#echo $1,$2,$3lineStartgrep -n $1 $3 | awk -F: {print $1} | head -n1lineEndgrep -n $2 $3 | awk -F: {print $1} | tail -n1echo lineStart is ${lineStart}, lineEnd is ${lineEnd}.if [ -z ${lineStart} ] || [ -z ${lineEnd} ]then echo lineStart and lineEnd cannot be empty!elseecho Retrieving the required log ... echo ########################################################sed -n ${lineStart},${lineEnd}p $3echo ########################################################echo Finished retrieving the required log ...fi
}if [ -f $FILEPATH ]
thenretrieveLog $1 $2 $FILEPATH
elseecho $FILEPATH does not EXIST! Please input the absolute log path.read -p 请输入日志文件路径: LOGPATHretrieveLog $1 $2 $LOGPATH
fi