arvind Posted September 6, 2004 Posted September 6, 2004 Is there some way to surpress output from a cron being emailed to you ? I want the output from other crons to be emailed just not from one, is that possible ? I have tried adding >-silent at the end but it makes no difference Thanks Quote
MikeJ Posted September 7, 2004 Posted September 7, 2004 Cron jobs only generate email when there's output from the process. The best way is to create the process that is being run in cron to only output errors. (Note: this is true for running programs in Linux and most Unixes in general, not just from cron.) If that's not possible, you can redirect regular output (and only get emails on error output) using the following format: >program > /dev/null This redirects (>) standard output to a null device (/dev/null), which means it supresses it. If you want to suppress all output including errors: >program > /dev/null 2>&1 This has the addition of redirecting standard error (2) to standard output (1) which is being redirected to a null device (/dev/null), therefore suppressing both errors and regular output. Quote
arvind Posted September 7, 2004 Author Posted September 7, 2004 Thanks Mike. So can I just add that to the end of my current cron command to surpress the errors ? UPDATE: OK I understood how to do it, heh ! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.