在系统紧急模式下自动重启?

问题描述 投票:0回答:1

当systemd进入紧急模式时,有可能提示而不是提示:

You are in emergency mode. After logging in, type "journalctl -xb" to view
system logs, "systemctl reboot" to reboot, "systemctl default" or "exit"
to boot into default mode.
Press Enter for maintenance
(or press Control-D to continue): 

并等待用户输入,它会在延迟后自动重启?

就我而言,这是必需的,因为在启动失败的情况下,我正在将操作系统回滚到以前的状态。

无论当前尝试启动的操作系统有什么问题,都必须进行此操作。我还没有找到任何关于此的信息,因此任何建议都将有所帮助!

谢谢

updates systemd boot reboot systemctl
1个回答
0
投票

好吧,我找到了一种方法来做自己想做的事情。我已经用systemctl edit emergency.service覆盖了紧急服务并添加了:

[Service]
ExecStartPre=/bin/sh -c "read -t 30 || /bin/systemctl reboot"

它将等待用户输入进入紧急模式。否则,系统将重新引导。

通过执行systemctl edit rescue.service,这也适用于救援模式。

© www.soinside.com 2019 - 2024. All rights reserved.