systemd关机流程 以及 自定义systemd关机脚本和服务
systemd关机流程 在使用systemd的linux系统中,reboot,shutdown,halt等命令是指向systemctl的软链接,执行reboot相当于执行 systemctl reboot,systemctl reboot 会切换到 reboot.target. 下面使用systemd进行系统关闭/重启的依赖关系图: (conflicts with (conflicts with all system all file system services) mounts, swaps, | cryptsetup | devices, ...) | | v v shutdown.target umount.target | | \_______ ______/ \ / v (various low-level services) | v final.target | _____________________________________/ \_________________________________ / | | \ | | | | v v v v systemd-reboot.service systemd-poweroff.service systemd-halt.service systemd-kexec.service | | | | v v v v