您当前的位置:首页 > 计算机 > 系统应用 > Linux

如何更改 crontab 任务结果的邮件接收人

时间:12-14来源:作者:点击数:

crond 的手册说明中有这么一段话

Cron  examines  all stored crontabs and checks each job to see if it
needs to be run in the current minute.  
When executing commands, any output is mailed to the owner of the
crontab (or to the user specified in the MAILTO environment
variable in the crontab, if such exists).  
Any job output can also  be  sent  to syslog by using the -s option.

也就是说,若想更改 crontab 的邮件接收人,只需要将 MAILTO 环境变量设置成其他用户即可,比如

MAILTO=root
* * * * *  command to be executed

会将命令执行结果发送给 root 而不是 crontab任务所有者,如果设置了 MAILTO,但其值为空,则表示不将结果通过邮件进行通知。

方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
栏目更新
栏目热门
本栏推荐