LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 05-31-2002, 01:59 AM   #1
elconde
Member
 
Registered: Sep 2001
Location: Cherry Hill, NJ
Distribution: Gentoo baby!
Posts: 67

Rep: Reputation: 15
Cron: E-Mail me only when necessary


I have written a shell script that I have Cron execute every hour. Cron e-mails me every hour when the script is executed. I would prefer it to e-mail me only when my script returns a non-zero exit status.

How should I go about doing this?


TIA,

Robert
 
Old 05-31-2002, 05:07 AM   #2
piranha
Member
 
Registered: Jan 2002
Distribution: Gentoo Linux 1.4
Posts: 52

Rep: Reputation: 15
put >/dev/null behind the command
 
Old 05-31-2002, 09:52 AM   #3
elconde
Member
 
Registered: Sep 2001
Location: Cherry Hill, NJ
Distribution: Gentoo baby!
Posts: 67

Original Poster
Rep: Reputation: 15
Ah, so simple.


Thanks!
 
Old 05-31-2002, 10:40 AM   #4
elconde
Member
 
Registered: Sep 2001
Location: Cherry Hill, NJ
Distribution: Gentoo baby!
Posts: 67

Original Poster
Rep: Reputation: 15
OK, so my crontab looks like this:

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.16401 installed on Fri May 31 09:49:31 2002)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
SHELL=/bin/tcsh
0 5 * * * /root/Cron/backup > /dev/null
5 * * * * /root/Cron/earlybird > /dev/null


but I'm still getting e-mails every hour. Did I do it right?


-R
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron mail sending using outside SMTP mail server Utah Linux - Software 6 08-24-2005 08:44 PM
Mail and Cron makk0 *BSD 1 09-21-2004 01:09 PM
No More Cron Mail, Cron Error? Xhost Linux - General 3 07-26-2004 05:28 PM
need only cron job mail on my mail id manojthakkar Linux - Newbie 0 12-20-2003 06:41 AM
cron mail help joesbox Linux - General 1 03-30-2003 11:20 PM


All times are GMT -5. The time now is 11:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration