Simple K-shell (Linux,UNIX) program to monitor concurrent programs and provide feedback.

Posted by Jiltin     19 March, 2009    4,605 views   

I wrote a Korn-shell (Linux,UNIX) program to monitor concurrent programs. This is tested and working well.
This is a simple sample to connect through sqlplus and select the fnd tables to get the status

#!/bin/ksh
#**************************************************************************************************
# This is the concurrent program monitor script
#
# In test cycles the programs failed to run or failed to be scheduled.
# This will constantly monitor the programs.
# It will automatically send an email alert if it fails
#
# Parameter: Concurrent Program Short name and the user run the program
#
#**************************************************************************************************
#
#
#
export USERNAME="$1"
export PASSWORD="$2"
export DATABASE="$3"
export CONCPROG="$4"
export CONCPROG="$5"
export APPSUSER="$6"

. /apps/${DATABASE}/appl_top/APPSORA.env

sqlplus -s ${USERNAME}/${PASSWORD} <<EOF

SET TERM OFF
SET NEWPAGE     0
SET SPACE       0
SET PAGESIZE    0
SET ECHO      OFF
SET FEEDBACK  OFF
SET HEADING   OFF
SET PAUSE     OFF
SET VERIFY OFF
set linesize 120

spool ${CONCPROG}.txt

select
fcr.REQUEST_ID‘-’
fu.user_name‘-’
fcr.PHASE_CODE‘-’
fcr.STATUS_CODE‘-’
trunc(( nvl(fcr.ACTUAL_COMPLETION_DATE,sysdate) –   fcr.ACTUAL_START_DATE) * 24 * 60,2)  ‘-’
–fcpt.USER_CONCURRENT_PROGRAM_NAME ‘-’
fcp.CONCURRENT_PROGRAM_NAME ‘-’
fcr.ACTUAL_START_DATE ‘-’
nvl(fcr.ACTUAL_COMPLETION_DATE,sysdate) RequestDetails
FROM
FND_CONCURRENT_REQUESTS FCR,
FND_CONCURRENT_PROGRAMS FCP,
FND_CONCURRENT_PROGRAMS_TL FCPT,
FND_USER FU
where  1=1
and    fcp.CONCURRENT_PROGRAM_ID=fcr.CONCURRENT_PROGRAM_ID
and    fcpt.CONCURRENT_PROGRAM_ID=fcp.CONCURRENT_PROGRAM_ID
AND    FCR.REQUESTED_BY = FU.USER_ID
AND    FU.USER_NAME = ‘${APPSUSER}’
and    fcp.CONCURRENT_PROGRAM_NAME = ‘${CONCPROG}’;

spool off;

EOF

# Grep "C-C" gives completed, normal status
RETVAL=`cat ${CONCPROG}.txt ‘ grep -i ${CONCPROG} ‘ grep -i "C-C" ‘ wc -l`; export RETVAL;
if [ ${RETVAL} != 0 ]
then
echo "${CONCPROG} completed successfully"
else
echo "${CONCPROG} not completed successfully"
fi

Post to Twitter  Post to Delicious  Post to Digg    Post to StumbleUpon

Categories : Oracle Applications, Scripts Oracle, Scripts Unix Tags : , ,

Comments
April 8, 2009

I noticed that this is not the first time you write about the topic. Why have you decided to write about it again?

April 15, 2009

If you ever want to see a reader’s feedback :) , I rate this article for four from five. Decent info, but I have to go to that damn google to find the missed parts. Thank you, anyway!

Leave a comment

(required)

(required)