揮発性のメモ2

http://d.hatena.ne.jp/iww/

rebootコマンドはsystemctlへのシンボリックリンク

イマドキのrebootコマンドはsystemctlへのシンボリックリンクになってた。知らなかった

Debian 10(buster)

# which reboot
/usr/sbin/reboot

# file /usr/sbin/reboot
/usr/sbin/reboot: symbolic link to /bin/systemctl

# ls -l /usr/sbin/reboot
lrwxrwxrwx 1 root root 14  319 04:59 /usr/sbin/reboot -> /bin/systemctl


昔は halt へのシンボリックリンクだったけど、systemdの頃から変わったらしい。

Debian 3(woody)

# which reboot
/sbin/reboot

# ls -l /sbin/reboot
lrwxrwxrwx  1 root root 4 Jul 16  2006 /sbin/reboot -> halt


rebootサービスは普段は動いていない(当たり前だ)

# systemctl status reboot
● reboot.service
   Loaded: masked (Reason: Unit reboot.service is masked.)
   Active: inactive (dead)

reboot.target を見たらなんか知らん変数があった

[Unit]
Description=Reboot
Documentation=man:systemd.special(7)
DefaultDependencies=no
Requires=systemd-reboot.service
After=systemd-reboot.service
AllowIsolate=yes
JobTimeoutSec=30min    ★1
JobTimeoutAction=reboot-force    ★2

[Install]
Alias=ctrl-alt-del.target

30分待っても再起動が完了しなかったら、reboot-forceするらしい。

reboot-force causes a forced reboot which will terminate all processes forcibly
but should cause no dirty file systems on reboot (i.e. equivalent to systemctl reboot -f)

and reboot-immediate causes immediate execution of the reboot(2) system call,
which might result in data loss.

systemd service automatic restart after StartLimitInterval - Server Fault

reboot-force は一応ファイルシステムのダーティキャッシュが無い状態にするけど、reboot-immediate はrebootシステムコールをすぐ呼ぶからデータは無くなっちゃうよ ということらしい。


これをいじれば、なにか深刻な問題が起きた時に30分待たずに強制再起動とかできそう