A Linux server running systemd booted to rescue.target for maintenance. Which commands are used to restore the server to its usual target? (Choose two.)
A.
telinit 0
B.
systemctl default
C.
sync
D.
systemctl emergency
E.
systemctl reboot
题解
「telinit」指令可以改变 runlevel。
「systemctl」指令可以控制 systemd 和服务系统。
「sync」指令可以将内存所缓存的文件实际写进保存设备中。
选项 A,切换到 runlevel 0 表示要关机。
选项 B,「systemctl」指令加上「default」参数(子命令)可以切换到预设的目标。如果要查看预设的目标,可以使用「get-default」参数(子命令);如果要修改预设的目标,可以使用「set-default」参数(子命令)。此为正确答案。
选项 C,错误。
选项 D,「systemctl」指令加上「emergency」参数(子命令)可以切换到「emergency.target」。这个指令是同步的,如果要让它异步运作,需加上「--no-block」参数。
选项 E,「systemctl」指令加上「reboot」参数等同使用「reboot」指令。可以让电脑重新开机,因此又会再进入预设的目标。此为正确答案。
