Wednesday, January 4, 2023

Purge R12.2 log files in Linux OS

Folder structure in R12.2 file system is more complicated than in R12.1, because RUN and PATCH may switch their location. After an adop cutover, the path to log files will be changed to a different one. Below are folders that have a growing number of log files. "ls" can be used to list the log files but "cd" do not work to reach the folder, while the path uses "*" in it.

$IAS_ORACLE_HOME/instances/*/diagnostics/logs/OHS/*/*.log*
$EBS_DOMAIN_HOME/servers/oacore*/logs/*.log*
$EBS_DOMAIN_HOME/servers/form*/logs/*.log*
$EBS_DOMAIN_HOME/servers/AdminServer/logs/*.log*

Fortunately, "find" works with path having "*" in it. Below lines work in cron to purge/delete old log files (on web/forms node).

$ crontab -l
05 05 * * * . /u07/app/.profile; /usr/bin/find $IAS_ORACLE_HOME/instances/*/diagnostics/logs/OHS/*/*log* -type f -mtime +30 -exec rm -f {} \;
05 15 * * * . /u07/app/.profile; /usr/bin/find $EBS_DOMAIN_HOME/servers/oacore*/logs/*log* -type f -mtime +30 -exec rm -f {} \;

Other logs or their locations:

$ADOP_LOG_HOME/*                   <== each ADOP session ID has a sub-folder
$INST_TOP/admin/log/MMDDHHMM/adconfig.log
$LOG_HOME/appl/admin/log/*      <== adstrtal.sh & adstpall.sh 
$LOG_HOME/appl/rgf/javacache.log 
$IAS_ORACLE_HOME/instances/*/diagnostics/logs/OPMN/opmn/* 
$EBS_DOMAIN_HOME/sysman/log/* 
$EBS_DOMAIN_HOME/servers/oac*/adr/diag/ofm/EBS_domain*/oac*/incident/* 
$EBS_DOMAIN_HOME/servers/forms_s*/adr/diag/ofm/EBS_domain*/forms_s*/incident/*
$INST_TOP/logs/ora/10.1.2/reports/cache/*.*

Locations or files for configuration and setups:

$IAS_ORACLE_HOME/instances/EBS_web*/config/OHS/EBS_web* 
$FMW_HOME/webtier/instances/EBS_web*/config/OPMN/opmn/* 
$CONTEXT_FILE
$INST_TOP/appl/admin/*.properties
$INST_TOP/ora/10.1.2/forms/server/default.env    (AutoConfig overwrites it)
$FND_TOP/fndenv.env
$EBS_DOMAIN_HOME/config/config.xml
$EBS_APPS_DEPLOYMENT_DIR/*/APP-INF/node_info.txt

.profile file (for account runs the crontab jobs on RHEL)
$ more .profile
PATH=/bin:/usr/bin:/usr/local/bin
export PATH

MANPATH=/usr/share/man:/usr/local/share/man:/usr/X11R6/man
export MANPATH

EDITOR=/bin/vi
export EDITOR

. /u07/app/EBSDEV/EBSapps.env RUN

isMaster="no"
if [ ! -z $APPS_VERSION ] && [ ${APPS_VERSION:0:4} == "12.2" ]
then
s_status=`cat $CONTEXT_FILE | grep -i s_adminserverstatus`
isMaster="${s_status:60:7}"
fi

if [ $isMaster == "enabled" ]
then

if [ `echo -n ${HOSTNAME%%.*} | tail -c -1` != "p" ]
then
PS1=$'
\e[0;31m$USER@${HOSTNAME%%.*}[$TWO_TASK]\e[m$PWD
-->$ '
else
PS1=$'
\e[0;31m$USER@${HOSTNAME%%.*}[$TWO_TASK]\e[m\E[32m$PWD \E[0m
-->$ '
fi

else

if [ `echo -n ${HOSTNAME%%.*} | tail -c -1` != "p" ]
then
PS1='
$USER@${HOSTNAME%%.*}[$TWO_TASK]$PWD
-->$ '
else
PS1=$'
$USER@${HOSTNAME%%.*}[$TWO_TASK]\E[32m$PWD \E[0m
-->$ '
fi

fi

alias rm='rm -i'
stty erase ^?

No comments: