Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
/bin/sh
#
# The purpose of the script is to do the following for each listener ...
# 1. "Swap" the listener log file
#
# Issued by Cron [55 23 * * 0]
#
# File : listenerlog_swap1.sh
# Author : Ravin Maharaj
# NB!! : Please do NOT modify or delete this script
# without prior consent from the author
MAILLIST="/usr/bin/utils/listener"
HOST=`uname -n`" : "
WorkDir="/oracle/scripts"
listeners="${WorkDir}/listeners"
lsnrcol5="${WorkDir}/lsnrcol5"
SUBJECT="Subject: "
if [ -s "${listeners}" ]
then
for i in `cat ${listeners}`
do
uptime=`lsnrctl status ${i} | grep Uptime`
if [ ${?} -eq 0 ]
then
lsnrlog=`lsnrctl status ${i} | grep "Listener Log" | awk '{print $4}'`
if [ ! -f "${lsnrlog}" ]
then
echo "${lsnrlog} does not exist"
echo "${HOST} ${lsnrlog} does not exist" >> ${MAILLIST}
exit 1
fi
printf "Now swapping the listener log for listener ${i}\n"
KeepLogFile="${lsnrlog}.`date '+%d%b%Y'`"
echo "LogFile is ${lsnrlog}"
# This will copy the listener log file to a save_set and initialise it
echo "Appending ${lsnrlog} to ${KeepLogFile}"
cat ${lsnrlog} >> ${KeepLogFile}
if [ ${?} -eq 0 ]
then
cat /dev/null > ${lsnrlog}
if [ ${?} -eq 0 ]
then
echo "${lsnrlog} initialised"
# Name of listener log file
# =========================
echo "${i}.log" > ${WorkDir}/lsnrlogfile
# Length (number of bytes) of name of listener log file
# -----------------------------------------------------
lngth_logfle=`cat ${WorkDir}/lsnrlogfile | \
awk '{print length($1)}`
# Remove temporary file
# ---------------------
rm -f ${WorkDir}/lsnrlogfile