Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mail from Cron

Status
Not open for further replies.

sethu

Programmer
Apr 15, 2000
29
US
Hi,

I have many cron jobs running on my Solaris 7 box. There are no failures in these jobs. The problem I have is I am getting a lot of mails eventhough the cron job was successful. I want to do two things.

1. How to supress mails which are comming even after successful completion of job? I want mail only if the cron was a failure.

2. How to get rid of the tons of mails which are already generated by different users?

--Sethu
 
Hi Sethu,

you could try redirecting the standard output for the command you're running through cron to /dev/null, if you're sure you don't want to see the messages. Do this by adding 1>/dev/null to your command.

The cron man entry has the following to say:

'If you do not redirect the standard output and standard error of your commands, any generated output or errors will be mailed to you.'

If you wish to get rid of users' old mail (presumably it contains nothing of note?), you can recreate the files in /var/mail using >username. Watch out for permissions, though.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top