The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
PHP Script that sends mail - Postfix breaks it boopfm523 Shell Programming and Scripting 0 03-05-2008 07:38 PM
Process mail using cron EOD UNIX for Dummies Questions & Answers 1 11-27-2004 05:34 PM
forward root mail csaunders SUN Solaris 1 11-23-2004 12:35 PM
root cron kupal UNIX for Dummies Questions & Answers 2 07-08-2002 11:10 AM
root cron was override w/ 3rd party software kupal UNIX for Dummies Questions & Answers 2 07-03-2002 08:55 PM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-25-2003
Registered User
 

Join Date: Aug 2002
Location: Philadelphia, PA
Posts: 75
Question Cron Sends mail to root on completion of job.

All
I am running a few scripts through a cron job. This is for checking some key services that are running on by box. The problem is, everytime the cron runs, it sends a mail to the root account. The root account mails need to cleared every now and then. Is there some way I can stop these mails from being sent or to send the mail only on failure of execution?

I am running Redhat Linux 7.3.

Thanks all in advance!!

KS
Forum Sponsor
  #2 (permalink)  
Old 04-25-2003
oombera's Avatar
Have a day :|
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
Here's a blurb from unixgeeks.org (note the bold):
Quote:
Output from cron

As I've said before, the output from cron gets mailed to the owner of the process, or the person specified in the MAILTO variable, but what if you don't want that? If you want to mail the output to someone else, you can just pipe the output to the command mail.

e.g.

cmd | mail -s "Subject of mail" user

If you wish to mail the output to someone not located on the machine, in the above example, substitute user for the email address of the person who wishes to receive the output.

If you have a command that is run often, and you don't want to be emailed the output every time, you can redirect the output to a log file (or /dev/null, if you really don't want the output).

e.g.

cmd >> log.file


Notice we're using two > signs so that the output appends the log file and doesn't clobber previous output. The above example only redirects the standard output, not the standard error, if you want all output stored in the log file, this should do the trick:

cmd >> logfile 2>&1
Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:10 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0