2

我在 us-east-1 区域上运行带有64 位 Amazon Linux的亚马逊 EC2 实例,并且我已将用户 ec2-user 的 TZ 设置为 Australia/Sydney。时间显示正确。然后我设置了 2 个 cron 任务来启动和停止东京的另一个亚马逊实例:

crontab -l
0 9 * * 1-5 python /home/ec2-user/scripts/instance.py demo ap-northeast-1 test-machine start > start.log
0 23 * * 1-5 python /home/ec2-user/scripts/instance.py demo ap-northeast-1 test-machine stop > stop.log

我认为他们应该在悉尼时间周一至周五上午 9 点和晚上 11 点运行。但是今天早上我检查了日志,发现start.log 的日期是 4 Jul 19:00 而 stop.log 是 5 Jul 9:00。这看起来很奇怪。谁能给我一些建议?该脚本已经过测试,可以手动正确执行,只需几秒钟即可运行。

问候,布鲁斯

4

1 回答 1

0

看起来您的脚本在正确的时间运行,考虑到 UTC。7 月 4 日 9:00 GMT == 7 月 4 日 19:00 在悉尼 (GMT +10),对吧?请验证您的 cron 设置。这里有一些提示。

于 2012-07-05T03:06:10.877 回答