From 8cc116b79068d7b25f5de5da6df96df3697e0b4a Mon Sep 17 00:00:00 2001 From: Yacine31 Date: Wed, 22 Dec 2021 17:35:24 +0100 Subject: [PATCH] script to purge adr logs --- adr_purge.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 adr_purge.sh diff --git a/adr_purge.sh b/adr_purge.sh new file mode 100644 index 0000000..01d4cf6 --- /dev/null +++ b/adr_purge.sh @@ -0,0 +1,30 @@ +# Purge ADR contents (adr_purge.sh) +# 00 05 * * 0 adr_purge.sh +# Add the above line with `crontab -e` to the oracle user's cron + +ALERT_RET="129600" # 90 Days +INCIDENT_RET="43200" # 30 Days +TRACE_RET="43200" # 30 Days +CDUMP_RET="43200" # 30 Days +HM_RET="43200" # 30 Days + +echo "INFO: adrci purge started at `date`" +adrci exec="show homes"|grep -v 'ADR Homes' | while read file_line +do + echo "INFO: adrci purging diagnostic destination " $file_line + echo "INFO: purging ALERT older than 90 days" + adrci exec="set homepath $file_line;purge -age $ALERT_RET -type ALERT" + echo "INFO: purging INCIDENT older than 30 days" + adrci exec="set homepath $file_line;purge -age $INCIDENT_RET -type INCIDENT" + echo "INFO: purging TRACE older than 30 days" + adrci exec="set homepath $file_line;purge -age $TRACE_RET -type TRACE" + echo "INFO: purging CDUMP older than 30 days" + adrci exec="set homepath $file_line;purge -age $CDUMP_RET -type CDUMP" + echo "INFO: purging HM older than 30 days" + adrci exec="set homepath $file_line;purge -age $HM_RET -type HM" + echo "" + echo "" +done +echo +echo "INFO: adrci purge finished at `date`" +