Linux: Programatically shutdown or reboot computer from a user-level process

后端 未结 2 1089
无人及你
无人及你 2021-01-21 14:21

How do I programatically trigger a system shutdown or reboot in Linux? Preferably without requiring elevated privileges.

On older releases (e.g. Ubuntu 10.04) I could ca

2条回答
  •  离开以前
    2021-01-21 15:03

    The shutdown command. However, that requires root privileges on most systems.

    Shutdown now:

    shutdown -h now
    

    Restart now:

    shutdown -r now
    

    man shutdown for more info.

提交回复
热议问题