AWS EC2 Ubuntu实例自动重启

0

【以下的问题经过翻译处理】 你好,

在AWS EC2 Ubuntu 20.04及更早版本上,我能够设置一个crontab在晚上关掉实例。

0 5 * * * /sbin/shutdown -h now

在Ubuntu 22.04上,服务器会自动重新启动,如何修改,使shutdown命令能够正常工作? 谢谢。

profile picture
EXPERT
asked 5 months ago41 views
1 Answer
0

【以下的回答经过翻译处理】 该实例可能已经开启了“自动恢复”功能。可以参考链接了解如何禁用该功能。 我已经在Ubuntu 20和22上复现了这种行为,但无法保证一直发生。在t2.small上发生的次数比t3.small上的多。此外,在第一次执行“sudo shutdown -h now”命令时,故障出现的概率更大。但在第一次失败后,该命令都可以正常执行。所有这些都与“自动恢复”设置无关。建议采取stop-instances API以确保一致性。此外,可以参考Instance Scheduler

profile picture
EXPERT
answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions