Solved

Cron Job success

Posted on 2013-01-25
6
513 Views
Last Modified: 2013-01-26
I quickly need to know.
How to make sure that if the cron job has run successfully in solaris?

Db:  Oracle
OS:  Solaris
0
Comment
Question by:taaz
6 Comments
 
LVL 73

Assisted Solution

by:sdstuber
sdstuber earned 150 total points
ID: 38818829
oracle doesn't interface with cron,

you could write a java stored procedure or c external procedure to invoke os commands.


or, if your cron job writes to a log file, you could use utl_file or a bfile to read the log and check status.


if you really want your database to monitor your job execution, you might want to consider using  dbms_scheduler inside the database
0
 
LVL 37

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE earned 150 total points
ID: 38818853
Several options:

- Have the cron job create output, redirected to a log file, watch the log file
- Have the cron job mail it's result in case of errors to you
0
 

Author Comment

by:taaz
ID: 38819017
that is exactly the option I am looking for.
How do I set up the cron job to send me an email once the job has run fail or success?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 73

Expert Comment

by:sdstuber
ID: 38819041
this isn't an oracle question at all?
0
 
LVL 23

Accepted Solution

by:
David earned 200 total points
ID: 38819602
# Ping if job was unsuccessful
SOMEJOB > /dev/null 2>&1
SOMEJOB_output=`echo $?`
###########   TEST CODE
echo "$SOMEJOB_output"
#######################
if [[ "$SOMEJOB_output" != "0" ]]; then
         echo "Trouble in River City..."
         mailx -s "SOMEJOB failure" user@domain.com >/dev/null
 else
         echo "MTS files in use; skipping"
fi

many sources and variations, but this source was from http://www.unix.com/shell-programming-scripting/126811-fuser-exit-code-different-when-script-run-cron.html.
0
 

Author Closing Comment

by:taaz
ID: 38822276
thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to recover a database from a user managed backup

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question