reboot和init 6的区别

本文探讨了Linux中init6与reboot命令的区别。init6通过执行一系列的shutdown脚本优雅地关闭系统并重启;而reboot则直接进行内核级重启,不执行应用级的shutdown脚本。推荐在常规情况下使用init6,在遇到问题或需强制重启时使用reboot。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

偶然一次机会:利用init 6重启机器,打开浏览器发现竟然还是保存这关机前的浏览网页,但是利用reboot就没有。

对此进行了搜索,结果如下:

对两个命令用man查询了一下:

init 6 Stop the operating system and reboot to the state defined by the initdefault entry in /etc/inittab.

reboot - reboot performs a sync(1M) operation on the disks, and then a

"init 6" 基于一系列/etc/inittab文件,并且每个应用都会有一个相应shutdown脚本。
'init 6' 调用一系列shutdown脚本(/etc/rc0.d/K*)来使系统优雅关机;
'reboot'并不执行这些过程,reboot更是一个 kernel级别的命令,不对应用使用shutdown脚本。 .
我们应该在通常情况下使用 init 6.
在出问题的状况下或强制重启 时使用reboot.

reboot is a more aggresive command to use. init 6 is much graceful

  • use of `init 6` will give the cleanest and orderly reboot (init informs svc.startd of the runlevel change and will move to the appropriate milestone).
  • use of `shutdown -y -g0 -i6 **message**` will invoke init as well as give you grace period and messages to user (shutdown invoked the same as init above).
  • halt,reboot,poweroff will not run any of the shutdown scripts and should be last resort.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值