The below script is to check Long running 12c forms in Forms Application server
#!/bin/bash
###############################################################################
# File Name : long_runn_forms.sh
# Author : Vimal Raju
# Date : 25/01/2020
# Description : Long running Forms
#
###############################################################################
hostName=`hostname -a`
LOG_LOC=/wwi/bssp/mw/fmw/scripts/log
logfile=/wwi/bssp/mw/fmw/scripts/log/pid.log
tmpfile=/wwi/bssp/mw/fmw/scripts/tmp/tmp.log
##mail=DBASupport@weightwatchers.com
mail=zzWeightWatchersSupport@dataintensity.com
> ${logfile}
time=$1
ltime=`expr ${time} \\* 60 \\* 60 `
ps -ef|grep “frmweb webfile”|grep -v “grep”| awk ‘{print $2}’ > ${tmpfile}
tmp=`cat ${tmpfile}|wc -l`
tmp1=1
while [ ${tmp1} -le ${tmp} ]
do
ct=`cat ${tmpfile}|awk “NR==”${tmp1}””`
test1=`stat -t /proc/${ct} | awk ‘{print $14}’`
test2=`date +%s`
test3=`expr ${test2} – ${test1}`
if [ ${test3} -gt ${ltime} ]
then
echo ” This process PID = ${ct} running long time in ${hostName} ” >> ${logfile}
kill -9 $ct
else
echo ” ”
fi
tmp1=`expr ${tmp1} + 1`
done
trig=`cat ${logfile}|wc -l`
check_tmp=`cat ${LOG_LOC}/form_trigger_tmp.log`
if [ “${trig}” -gt 0 ]
then
echo C > ${LOG_LOC}/form_trigger.log
elif [ “${check_tmp}” = ‘T’ ]
then
echo N > ${LOG_LOC}/form_trigger.log
fi
check_crit=`cat ${LOG_LOC}/form_trigger.log `
if [ “${check_crit}” = ‘C’ ]
then
cat ${logfile} |mailx -s “Critical : BOSS long running Forms in ${hostName}” $mail
echo T > ${LOG_LOC}/form_trigger_tmp.log
elif [ “${check_crit}” = ‘N’ ]
then
echo ” No long running forms in ${hostName} ” |mailx -s “Normal : BOSS long running Forms in ${hostName}” $mail
echo “” > ${LOG_LOC}/form_trigger.log
echo “” > ${LOG_LOC}/form_trigger_tmp.log
fi