温馨提示×

Linux shutdown怎样指定关机原因

小樊
104
2025-01-01 21:06:00
栏目: 智能运维

在Linux中,您可以使用shutdown命令来执行关机或重启操作

sudo shutdown -h -c "Your reason for shutdown"

在这个命令中:

  • -h 表示关机(halt)。
  • -r 表示重启(reboot)。
  • -c 表示取消关机(cancel)。
  • "Your reason for shutdown" 是您要指定的关机原因。请将其替换为您想要的原因。

例如,如果您想要因为系统更新而关机,您可以运行以下命令:

sudo shutdown -h -c "System update complete"

这将向所有用户显示一条消息,告知他们关机的原因。然后,系统将取消当前的关机计划。

0