【问题标题】:How can I email one of the cronjob lines to a different email address?如何将其中一条 cronjob 行通过电子邮件发送到不同的电子邮件地址?
【发布时间】:2015-11-30 19:45:43
【问题描述】:

我在 crontab 中将 MAILTO 设置设置为某个电子邮件地址,例如 a@ab.com

cron 中有大约 10 个条目在不同的行上,在不同的时间运行,我想添加第 11 行但将其发送到不同的电子邮件地址。

如何在 crontab 中执行此操作?

awk 'last ~ "<cert>" && $0 ~ "</cert>" {print FILENAME; nextfile} {last=$0}' *

我尝试过使用输出命令,但它只是输出到文件。

【问题讨论】:

    标签: cron


    【解决方案1】:

    只需在第 11 行之前添加一个不同的 MAILTO 行 - 该设置将对所有后续 cron 行保持有效:

    MAILTO='a@ab.com'
    * * * * * /cmd1
    # other crontab jobs here, all emailing to 'a@ab.com'
    * * * * * /cmd10
    
    MAILTO='someone_else@ab.com'
    # following crontab jobs emailing to 'someone_else@ab.com'
    * * * * * /cmd11
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-11-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多