Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 Amazon Ubuntu 实例,我停止并启动(不终止)。我想知道是否可以在服务器启动和停止时运行脚本。具体来说,我正在考虑编写一个 python boto 脚本以在 EC2 服务器未运行时使我的 RDS 卷脱机。
谁能告诉我这是否可能?
有可能的。您只需要编写一个初始化脚本并在 /etc/rc#.d 目录中设置正确的符号链接。它将使用参数启动,start或者stop取决于机器是启动还是关闭。
start
stop