1835955 Members
3244 Online
110088 Solutions
New Discussion

Shell Script Help

 
Inder_2
Occasional Contributor

Shell Script Help

Hi,

I have write a shell script where it checks for failed concurrent programs and then if there are any failed conc programs then send an email to support@xyz.com to notify users.

Does any body have a code snippet for doing this.

I have the sql to check for failed processes....

select b.request_id,
a.user_concurrent_program_name,
b.actual_start_date,
b.oracle_process_id,
b.oracle_session_id,
b.os_process_id
from
fnd_concurrent_programs_vl a,
fnd_concurrent_requests b,
fnd_user c
where
a.concurrent_program_id=b.concurrent_program_id
and a.concurrent_program_id=46020
and b.status_code='E'
/
1 REPLY 1
Ken Grabowski
Respected Contributor

Re: Shell Script Help

Hi Ider,

There are some good Nutshell books on script programming that you should take a look at.

A few quick things that might get you started are:

Start script with:
#!/usr/bin/sh

To run the sql script do something like:

sql "command line login information here" > Output.file 2>&1 << EOF
"your sql script here
.
.
"
EOF

Now use something like grep or awk to parse the Output.file to detect the errors. You can e-mail error messages by streaming a message to mailx.

echo "my message" | mailx -s "Subject Line" support@xyz.com

Hope that helps get you started.