Cron job: problem with crontab, it automatically sending me an email
How can 开发者_运维知识库I disable the email on the cron?
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.
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.
精彩评论