Shell Script to Monitor and Get Alert for Workflow Notification Mailer and Components in Oracle Apps

I am going to share how to check workflow notification mailers and service components using shells scripts.
There can be multiple methods to do the same and write scripts

Create a SQL script

cat wf_mailer_status_component.sql

spool /tmp/wf_mailer_status_component.log
alter session set nls_date_format='DD-MON-RRRR HH24:MI:SS';
select sysdate from dual;
select component_id,component_name,component_status from apps.fnd_svc_components where component_id in ('10002','10003','10004','10005','10006','10040','10022','10023')
and component_status <> 'RUNNING';
spool off

Create a shell script to call the SQL and trigger the alert to send mail


. /u01/oracle/FUAT/apps/apps_st/appl/APPSFUAT_sgap2.env
sqlplus "apps/apps" @/home/applmgr/bin/wf_mailer_status_component.sql
cnt=`grep -c "no rows selected" /tmp/wf_mailer_status_component.log`
if [ $cnt -eq 0 ]
   mailx -s "Critical: FUAT - Workflow Notification Mailer Components Not Running" < /tmp/wf_mailer_status_component.log

Schedule cron to run every 15 mins

*/15 * * * * /home/applmgr/bin/  >/tmp/wf_components.log 2>&1

If you like please follow and comment