UNIX command for checking the cron job failures?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX command for checking the cron job failures?
# 1  
Old 09-09-2014
UNIX command for checking the cron job failures?

Hi- I need to set a mail trap for checking the cron job filures in a server.

I have many cron jobs running in our server. What unix command will identify the failed cron jobs?

Your thoughts please!!!!!
# 2  
Old 09-09-2014
Hello ChandruBala73,

If you are the root for your system then you can check the cron logs at /var/log/cron at the first place.

Thanks,
R. Singh
# 3  
Old 09-09-2014
Hi,

You don't say what your flavour of Unix is, however all you should have to do is;

Code:
vi /etc/crontab

And change the MAILTO variable to the destination required. Then all that should be required is to redirect standard error to standard out for your scripts/cron jobs.

Regards

Dave

Last edited by gull04; 09-09-2014 at 10:13 AM.. Reason: Missed info out
This User Gave Thanks to gull04 For This Post:
# 4  
Old 09-09-2014
Hi All- Thanku Ravinder/Gull for the useful posts.

I do not have root accessSmilie
# 5  
Old 09-09-2014
Hi,

You will have to request some assistance from your admin team, although you should remember that any user (if allowed) may use the cron daemon and have their own crontab file - where the output from any cron jobs including mails will be sent to that user.

Regards

Dave
# 6  
Old 09-09-2014
By default every output, stdout or stderr, is causing a mail to userid@server.
You can redirect it in the crontab like this
Code:
* * * * * { yourcommand; } 2>&1 | mail yourmail@address


Last edited by MadeInGermany; 09-10-2014 at 07:57 AM..
# 7  
Old 09-10-2014
cron should log results to syslog; mayhap your admins can hand you an extract on a daily basis?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cron job cannot run the command

Hi, I created this cron job for asterisk to send sms daily to a number #!/bin/sh #custom mod - send sms once a day, at 07:00. CRON_PATH="/etc/asterisk/gw/crontabs_root"; if ! grep 'gsm send sms' $CRON_PATH > /dev/null 2>&1 ;then echo "* 7 * * * asterisk -rx 'gsm send sms 1 7666... (4 Replies)
Discussion started by: jazzyzha
4 Replies

2. Shell Programming and Scripting

Shell script to set trap for finding cron job failures

Unix box: solaris 5.8 Server: IP Need to to set trap for cron job failures by writing a shell script (5 Replies)
Discussion started by: ChandruBala73
5 Replies

3. Shell Programming and Scripting

Cron Job - date command problem

Hi I have one problem with cron job in Control Panel. I have a log file that is created once a day on another server and I need to transfer it in an exact time to my server so I wrote the cron job for it BUT the problem is in the date command: /filelog-`date +%Y-%m-%d`.tar.gz; The file... (1 Reply)
Discussion started by: bobo_balde
1 Replies

4. Shell Programming and Scripting

cron job: command not found

Hi, I have a simple script. When I run it as cron job. I jot email saying: /bin/sh: line 1: test.tmp: command not found. the test.tmp looks like: #!/bin/sh date > done Even I took first line out, I got the same error. The current shell I have is /bin/tcsh Could anyone help me... (2 Replies)
Discussion started by: natxie
2 Replies

5. Shell Programming and Scripting

Problem with sar command in cron job

HI, I have a problem with 'sar' command. I am using the sar comman in script.when i execute the script manually using ./filenae, i am getting the desired output. But when i put the script in cron job i am not getting the desired value. Below is the script.. sar > $_LOCATION/sar.txt... (2 Replies)
Discussion started by: ahamed
2 Replies

6. UNIX for Dummies Questions & Answers

Cron job to run a command from another dir?

I would like to setup a cron job to run a command from another directory. What is the best way to do this? The cron file is in a directory and the script I want it to run is in another directory. I tried doing this in the cron file: /location/of/command/run.sh But that did not work.... (2 Replies)
Discussion started by: Sepia
2 Replies

7. Shell Programming and Scripting

Checking the cron process in unix

Hi Experts, Is there any command by which i can chk that the cron process is running fine? Say i have scheduled the cron to run at 10 o clock every monday,Do i need to wait for the time it runs and then chk using ps -ef? Please shed some light. Thanks Ashok. (2 Replies)
Discussion started by: Ashok_oct22
2 Replies

8. HP-UX

Unix - Cron Job Help

Up until now I used Oracle's Enterprise manager to submit the batch job. However its SMTP function (Sends EMail about Job status) is unstable lately. I want to use Unix's Cron to submit my batch job. This way I can also eliminate the middle layer (Oracle's Enterprise manager). Please help how I can... (1 Reply)
Discussion started by: aixhp
1 Replies

9. Shell Programming and Scripting

Sudo command not working with cron job.

Hello, I have written a script that has a sudo command to change file permissions within it. When I run the script manually, the sudo command inside of it works fine. When the script is run through crontab I get the error "cron: not found". It the same user profile that I am using... (6 Replies)
Discussion started by: WhotheWhat
6 Replies

10. SuSE

inconsistent ls command display at the command prompt & running as a cron job

Sir, I using the following commands in a file (part of a bigger script): #!/bin/bash cd /opt/oracle/bin ls -lt | tail -1 | awk '{print $6}' >> /tmp/ramb.out If I run this from the command prompt the result is: 2007-05-16 if I run it as a cron job then... (5 Replies)
Discussion started by: rajranibl
5 Replies
Login or Register to Ask a Question