【问题标题】:Setting crontab task in Amazon Lightsail to EST将 Amazon Lightsail 中的 crontab 任务设置为 EST
【发布时间】:2021-04-12 08:46:06
【问题描述】:

我正在尝试将 Amazon Lightsail 上的 crontab 作业设置为每天美国东部标准时间晚上 11:55 运行。该作业运行一个非常简单的 Python 脚本。作业执行,但改为在东部标准时间下午 6:55。我尝试在 crontab 中同时设置 CRON_TZ=America/New_York,以及在 timedatectl 中将本地时间更改为 EST,但都没有更新运行 EST 的时间。

如何让我的工作在美国东部标准时间晚上 11:55 在 Lightsail 上运行?

这是我的 crontab 代码:

CRON_TZ=America/New_York

53 23 * * * /usr/bin/python3.6 /home/ubuntu/path-to-script/script.py

这是我的时区信息:

ubuntu@ip-###:~$ timedatectl
                      Local time: Wed 2021-01-06 10:24:42 EST
                  Universal time: Wed 2021-01-06 15:24:42 UTC
                        RTC time: Wed 2021-01-06 15:24:43
                       Time zone: America/New_York (EST, -0500)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

【问题讨论】:

    标签: python amazon-web-services cron amazon-lightsail


    【解决方案1】:

    假设您使用的是 Trusty (14.04),但在基于 linux 的系统中步骤应该类似。请尝试以下步骤:

    sudo dpkg-reconfigure tzdata - follow the instructions to select Region/Country
    sudo service cron restart
    timedatectl - Verify your date settings
    

    我也在AWs Developer Forum 上找到了类似的帖子。

    【讨论】:

      猜你喜欢
      • 2017-12-10
      • 2013-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-10
      • 2014-01-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多