Operating System - HP-UX
1829108 Members
14064 Online
109986 Solutions
New Discussion

how to suppress error messages

 
Charles Li_2
Occasional Advisor

how to suppress error messages

I has a cron that when run will generate an email message of the cron's output.
Is there a way to tell it not to generate the output?

Thanks
3 REPLIES 3
Steven E. Protter
Exalted Contributor

Re: how to suppress error messages

You can pipe the output to /dev/null

scriptname > /dev/null

You will get no output.

You may not be able to figure out when it fails.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sridhar Bhaskarla
Honored Contributor

Re: how to suppress error messages

A cronjob will generate an email if it is explicitly told to or if it exits with an error. If the mail statement is within the script itself, then you will need to modify the script and find for "sendmail|mailx|elm" etc., If not, then it may be directly fed into the cron entry itself in which you will need to redirect the output to /dev/null instead to the mail agent. Post your cron entry "crontab -l" and one should be able to figure it out.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Umapathy S
Honored Contributor

Re: how to suppress error messages

Charles,
As SEP suggested, you can suppress the output of the scripts which are kicked of by cron by redirecting to /dev/null.
For stdout 1>/dev/null and for other error messages 2>/dev/null.

HTH,
Umapathy
Arise Awake and Stop NOT till the goal is Reached!