Linux中poweroff指令用来关闭计算机操作系统并且切断系统电源。poweroff、reboot和halt可分别用于关机、重启或停止机器。这三个指令都有相同的选项。
poweroff的命令格式,
poweroff [OPTIONS...]
常用选项,
-d, --no-wtmp
关闭操作系统时,不将操作写入日志文件“/var/log/wtmp”。
-f, --force
强制关闭操作系统。
-n, --no-sync
关闭操作系统前不同步硬盘/存储介质。
-w, --wtmp-only
不真正关闭操作系统,仅在日志文件“/var/log/wtmp”中写入 wtmp 关闭条目。
-p, --poweroff
不管调用 poweroff、reboot 和 halt 中的哪一个,都要切断主机电源。
--help
显示帮助信息。
--halt
不管调用 poweroff, reboot 和 halt 中的哪一个,都要停止机器。
--no-wall
请勿在 poweroff, reboot 或 halt 前发送留言。
其中poweroff -p,相当于直接拔电源关机,可以用来模拟某些服务器hang的场景,可以通过man poweroff,了解参数含义,
-p, --poweroff
Power-off the machine, regardless of which one of the three commands is invoked.
可能有朋友了解用过shutdown等指令,通过man,可以知道它的某些参数,就相当调用poweroff、halt、reboot,
--help
Print a short help text and exit.
-H, --halt
Halt the machine.
-P, --poweroff
Power-off the machine (the default).
-r, --reboot
Reboot the machine.
-h
Equivalent to --poweroff, unless --halt is specified.
-k
Do not halt, power-off, reboot, just write wall message.
--no-wall
Do not send wall message before halt, power-off, reboot.
-c
Cancel a pending shutdown. This may be used cancel the effect of an invocation of shutdown with a time argument that is not "+0" or "now".
如果您认为这篇文章有些帮助,还请不吝点下文章末尾的"点赞"和"在看",或者直接转发pyq,
近期更新的文章:
《MySQL 8.0新密码策略的细节场景讲解》
《几种数据泄露场景的排查解决路径》
《最近碰到的一些问题》
《金融知识小科普 - 量化交易》
《公众号1300篇文章分类和索引》
近期的热文:
《推荐一篇Oracle RAC Cache Fusion的经典论文》
《"红警"游戏开源代码带给我们的震撼》
文章分类和索引:
《公众号1200篇文章分类和索引》