Linux shutdown 命令
Linux shutdown 命令可以用来挂起、关机或者重启设备,执行成功的话会返回0。
官方定义为:
shutdown – Halt, power-off or reboot the machine
语法
使用方法如下:
$ shutdown [OPTIONS…] [TIME] [WALL…]
第一个参数可能是一个时间字符串 (通常是 now),一般而言,后面可以跟上一个提示消息来通知登陆的用户系统马上进行的操作。
时间字符串的一般为hh:mm,表示经过多长时间进行关机,当然比较常用的为+m,也就是m分钟后执行操作。
参数如下所示:
-H, –halt 挂起机器
-P, –poweroff关机(默认选项)
-r, –reboot 重启机器
-h 等效于–poweroff,出发专门指定 –halt选项
-k不进行挂起、关机或者重启,仅仅发送通知信息
–no-wall :挂起、关机或者重启前,不发送信息
-c 取消当前正在进行的关机动作,前提是参数不是now
立即关机
$ shutdown -h now
十分钟后关机
$ shutdown -h 10
增加提示信息
$ shutdown -h 10 “The system will shutdown in 10 minutes, save your work immediately”
17:30关机
$ shutdown -h 17:30
增加提示信息
$ shutdown -h 17:30 “The system will shutdown in 17:30, remember to save your work”
重新启动计算机
$ shutdown -r now
声明:文中观点不代表本站立场。本文传送门:https://eyangzhen.com/92752.html