Solved

Cron Job success

Posted on 2013-01-25
6
516 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 74

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 38

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 74

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

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

856 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