LoginSignup
4
6

More than 5 years have passed since last update.

【AWS】EC2で構築したLinuxサーバを停止し忘れるのでCronでshutdownするように仕掛けてみた

Posted at

今後のためにメモメモ。。。

昔、サーバを停止忘れて課金されてことがあったので、Cronに頼ることに。。。
他のやり方もあるはずだけど、今回はCronでのやり方をメモメモ。

-

0.設定

[root@ip-172-31-30-138 ~]# crontab -l
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin:/root/bin:/opt/aws/bin
MAILTO=""
0 0 * * * shutdown -h now  2>&1

上のように設定すればOK!!!!

4
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
6