首页 > 代码库 > init shutdown reboot poweroff halt区别
init shutdown reboot poweroff halt区别
init
首先看看LINUX系统几种运行级别
# 0 - 停机(千万别把initdefault设置为0,否则系统永远无法启动)
# 1 - 单用户模式
# 2 - 多用户,没有 NFS
# 3 - 完全多用户模式(标准的运行级)
# 4 – 系统保留的
# 5 - X11 (x window)
# 6 - 重新启动 (千万不要把initdefault 设置为6,否则将一直在重启 )
#init 0 切换到运行级别0
动作为运行如下两个脚本:
[root@limt rc0.d]# pwd/etc/rc.d/rc0.d[root@limt rc0.d]# ls -lrt S*lrwxrwxrwx. 1 root root 14 Jun 16 2013 S01halt -> ../init.d/haltlrwxrwxrwx. 1 root root 17 Jun 16 2013 S00killall -> ../init.d/killall
#init 6 切换到运行级别6
动作为运行如下两个脚本:
[root@limt rc6.d]# pwd/etc/rc.d/rc6.d[root@limt rc6.d]# ls -lrt S*lrwxrwxrwx. 1 root root 14 Jun 16 2013 S01reboot -> ../init.d/haltlrwxrwxrwx. 1 root root 17 Jun 16 2013 S00killall -> ../init.d/killall
shutdown
shutdown - bring the system downshutdown [OPTION]... TIME [MESSAGE] -r Requests that the system be rebooted after it has been brought down. -h Requests that the system be either halted or powered off after it has been brought down, with the choice as to which left up to the system. -H Requests that the system be halted after it has been brought down. -P Requests that the system be powered off after it has been brought down. -c Cancels a running shutdown. TIME is not specified with this option, the first argument is MESSAGE. -k Only send out the warning messages and disable logins, do not actually bring the system down.
#shutdown -r 等同reboot,它在系统关闭之前给系统上的所有登录用户提示一条警告信息,然后调用init 6#shutdown -H 等同halt 它在系统关闭之前给系统上的所有登录用户提示一条警告信息,然后调用init 0#shutdown -P 等同poweroff 它在系统关闭之前给系统上的所有登录用户提示一条警告信息,然后调用init 0
reboot,poweroff,halt
reboot,poweroff,halt实际为一个命令,后两者为reboot的链接
[root@limt rc0.d]# ls -lrt /sbin/reboot-rwxr-xr-x. 1 root root 14832 3月 20 2012 /sbin/reboot[root@limt rc0.d]# ls -lrt /sbin/poweroff lrwxrwxrwx. 1 root root 6 6月 16 2013 /sbin/poweroff -> reboot[root@limt rc0.d]# ls -lrt /sbin/halt lrwxrwxrwx. 1 root root 6 6月 16 2013 /sbin/halt -> reboot
不带--force参数的reboot实际是调用shutdown名,带--force参数的reboot直接关机
init shutdown reboot poweroff halt区别
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。