Solved

Cron Job success

Posted on 2013-01-25
6
518 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

756 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