我在 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。这看起来很奇怪。谁能给我一些建议?该脚本已经过测试,可以手动正确执行,只需几秒钟即可运行。
问候,布鲁斯