自宅サーバを自動的に終了する(輪番停電対策)
輪番停電|関東←すばらしい
1年ぶりの更新なのは置いといて.
私が住んでいる関東は輪番停電の対象地域.
自宅サーバが停電の度にブチッと切れるのはよろしくないので,
cronで自動シャットダウンをすることにしました.
$ sudo crontab -e
でcrontabの編集をします.
中身はこんな感じ.ちなみに第1グループの今後一週間.
SHELL=/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow command 15 18 * * sat shutdown -h now 15 15 * * sun shutdown -h now 15 12 * * mon shutdown -h now 15 9 * * tue shutdown -h now 45 16 * * tue shutdown -h now 15 6 * * wed shutdown -h now 45 13 * * wed shutdown -h now 15 18 * * thu shutdown -h now
毎週,更新しないといけないのがスマートじゃないけど諦める(ぉぃ
曜日で決まってればいいんだけどね.