Question

How can I disable the email on the cron?

Was it helpful?

Solution

You can redirect the output to /dev/null like this:

* * * * * my_command > /dev/null

If an error occurs, you'll still get an email, though.

OTHER TIPS

Send the standard output (and standard error) of your cron job to /dev/null

* * * * *  /some/cron/job 1> /dev/null 2>&1

If you'd prefer a log file, change /dev/null to a real filename instead, but be aware of the security issues. Specifically, if you're running with any sort of privileged account and the log file doesn't already exist, a hacker can pre-create a symlink in place of your log file, pointing at some other file. When your cron job runs the target of the symlink gets overwritten.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top