【问题标题】:How to setup cron job on Amazon Linux AMI如何在 Amazon Linux AMI 上设置 cron 作业
【发布时间】:2021-09-18 06:32:45
【问题描述】:

我正在托管 Tiny Tiny RSS 网站,托管在

亚马逊 Linux AMI

要自动更新提要,我必须运行以下 cron 作业。

参考 http://tt-rss.org/redmine/projects/tt-rss/wiki/UpdatingFeeds

*/30 * * * * /usr/bin/php /var/www/html/tt-rss/update.php --feeds --quiet

这是我做的步骤:

  1. 须藤苏
  2. cd /etc
  3. crontab -e
  4. 添加此行 */30 * * * * /usr/bin/php /var/www/html/tt-rss/update.php --feeds --quiet

但我仍然收到消息“更新守护程序未运行”。

请问这是 cron 作业的正确步骤吗?

我的第一个设置。

谢谢, 亚历克斯

【问题讨论】:

  • 你能把$ /usr/bin/php /var/www/html/tt-rss/update.php --feeds的结果贴出来
  • 这看起来像是每 30 分钟运行一次并且一旦完成就停止的东西,而不是一个守护进程。不幸的是,提供的链接实际上并未链接到说明。 ;)

标签: linux amazon-ec2 rss crontab


【解决方案1】:

您应该首先检查 cron 日志文件 /var/log/cron 并查找任何错误。这可能会给你答案。还要确保您可以在命令行 (/usr/bin/php /var/www/html/tt-rss/update.php --feeds --quiet) 上成功运行该命令。

【讨论】:

    【解决方案2】:

    您应该在 Amazon Linux 2 上输入这些命令:

    sudo systemctl start crond
    sudo systemctl enable crond
    

    【讨论】:

    • 我收到了:sudo systemctl start crondsudo: systemctl: command not foundsudo systemctl start crondsudo: systemctl: command not found
    • 也许您使用的是 Amazon Linux 1,它适用于最新的 Amazon Linux 2
    • 试用了最新的amazon linux 2
    • Gal 如果你已经运行了 sudo su - 那么你不需要在命令中包含sudo
    【解决方案3】:

    这听起来像crond 没有运行。在这种情况下:

    service crond start
    chkconfig crond on
    

    【讨论】:

      【解决方案4】:

      请检查空格,可能是因为空格没有正确放置

      【讨论】:

        【解决方案5】:

        只需这样做: * * * * * wget -o - -q -t 1 "你的 url 和 cron 文件"

        【讨论】:

          【解决方案6】:

          请从您的 cron 命令中删除“--quiet”部分,然后检查日志并再次提要

          【讨论】:

            猜你喜欢
            • 2019-12-08
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2013-11-25
            • 1970-01-01
            • 2018-04-09
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多