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/halt
lrwxrwxrwx. 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/halt
lrwxrwxrwx. 1 root root 17 Jun 16 2013 S00killall -> ../init.d/killall

shutdown

shutdown - bring the system down
shutdown [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区别的更多相关文章

  1. 【2016-10-11】Linux系统常用的关机或重启命令shutdown、reboot、halt、poweroff、init 0及init 6的联系与区别

    Linux下常用的关机/重启命令一般包括: shutdown.reboot.halt.poweroff等,当然了我们可以使用init 运行等级runlevel 0即halt来关机,或使用init 运行 ...

  2. 正确的关机方法: sync, shutdown, reboot, halt, poweroff, init

    正常情况下,要关机时需要注意底下几件事: 观察系统的使用状态: 如果要看目前有谁在在线,可以下达『who』这个命令,而如果要看网络的联机状态,可以下达 『 netstat -a 』这个命令, 而要看背 ...

  3. 简单理解Busybox下halt/poweroff/reboot实现及区别

    关键词:halt/poweroff/reboot.reboot().SIGUSR1/SIGTERM/SIGUSR2等. 1. busybox下的halt/poweroff/reboot实现 通过app ...

  4. linux reboot ,shutdown,halt区别

    reboot ,shutdown,halt区别 重启   reboot  和 shutdown -r now  效果是一样的都是重启 区别在于reboot 是重启时,删除所有的进程,为不是平稳的终止他 ...

  5. 理解Linux中的shutdown、poweroff、halt和reboot命令

    原文  http://os.51cto.com/art/201706/541525.htm   在本篇中,我们会向你解释 shutdown.poweroff.halt 以及 reboot 命令.我们会 ...

  6. halt, reboot, poweroff - 中止系统运行

    SYNOPSIS /sbin/halt [-n] [-w] [-d] [-f] [-i] [-p] /sbin/reboot [-n] [-w] [-d] [-f] [-i] /sbin/powero ...

  7. Linux常用命令学习3---(文件的压缩和解压缩命令zip unzip tar、关机和重启命令shutdown reboot……)

    1.压缩和解压缩命令    常用压缩格式:.zip..gz..bz2..tar.gz..tar.bz2..rar .zip格式压缩和解压缩命令        zip 压缩文件名 源文件:压缩文件   ...

  8. JAVA线程池shutdown和shutdownNow的区别

    一.区别介绍 shutDown()  当线程池调用该方法时,线程池的状态则立刻变成SHUTDOWN状态.此时,则不能再往线程池中添加任何任务,否则将会抛出RejectedExecutionExcept ...

  9. shutdown和close的区别

    [shutdown和close的区别] 当所有的数据操作结束以后,你可以调用close()函数来释放该socket,从而停止在该socket上的任何数据操作:close(sockfd); 你也可以调用 ...

随机推荐

  1. final和包装类

    ==================================================================================================== ...

  2. Android issues

    1. Android studio 2.0 Error:Exception in thread "main" java.lang.UnsupportedClassVersionEr ...

  3. NFC OMA 访问

    正常的OMA访问: 但基本上IC原厂都会提供NFC swp-sim这一块的访问,但关于NFC内部eSe的访问一般NFC服务商又会整一套出来,导致有两套独立的SmartcardSevice需要运行,但他 ...

  4. The note of Vue.js

    In computed field, increment operator is not supported.

  5. Android笔记:蓝牙

    if (!BTAdapter.isEnabled()) { //没有打开,就启动确认窗口询问用户是否打开 Intent i = new Intent(BluetoothAdapter.ACTION_R ...

  6. superSlider实现美女轮播图

    superSlider实现美女轮播图 <!DOCTYPE html><html lang="en"><head><meta charset ...

  7. 测试css

    <h1>shell使用指南</h1> <h2>ZMODEM功能</h2> <pre><code>yum install lrzs ...

  8. Linux 相关面经

    都说没用过Linux都不要说自己搞过开发.我因为项目就是Linux没办法才接触Linux的,不过用了一段时间大黑屏外人看不懂的样子感觉还是屌屌的,虽说用过但知道也仅限于权限内的一些知识,还是一起看下面 ...

  9. Hamilton四元数群的表示

    Hamilton四元数群$Q_8=\mathbb H=\{\pm e,\pm i,\pm j,\pm k\}$满足如下运算法则: $e$为单位元且同号得正.异号得负,此外$e=i^2=j^2=k^2, ...

  10. windows 用默认软件打开文档

    System.Diagnostics.Process.Start("Explorer.exe", string.Format("/e, \"{0}\" ...