研究配置MAILTO的可能性,这样我们就很少有cron可以将邮件发送到一个电子邮件ID,而将其他邮件发送到另一个电子邮件ID。
以下工作有效吗?
MAILTO="email1@"
SHELL=/bin/zsh
0,30 * * * * <cron job>
0 1 * * * shashi zsh -c "export MAILTO='email2@';find /home/y/logs/ -daystart -type f -ctime +7 -print -exec rm -rf {} \;"
Run Code Online (Sandbox Code Playgroud)
我希望第一个cron作业默认发送到'email1 @',而第二个cron条目发送到'email2 @',因为我们已经覆盖了MAILTO。