Ubuntu: How to Force a Silent Cron | The Rugged Rock of Craig
Ubuntu: How to Force a Silent Cron
Posted on Tuesday, January 4, 2011 by Craig Lotter
By default, cron actions that produce output generates emails that get sent to the system administrator. If we don’t particularly want this behaviour, we need to terminate our function calls with a specific character sequence, which looks as follows:
5 * * * * /usr/mine/script > /dev/null 2>&1
The first part of the statement sends the output to the “bit bucket” (> /dev/null) which is basically the same as throwing it away. The second part of the call (2>&1) forces all generated stderror error messages to follow the stdout messages, which in this case we’ve already pointed towards the “bit bucket”.
Simple, and effective, if you don’t want to be bothered by a whole lot of non-critical cron jobs!
viaUbuntu: How to Force a Silent Cron | The Rugged Rock of Craig.