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. 委托、Lambda表达式和事件

    1.1 引用方法      委托是寻址方法的 .NET 版本.委托是类型安全的类.它定义了返回类型和参数的类型.委托类不仅包含对方法的引用,也可以包含对多个方法的引用.      Lambda 表达式 ...

  2. .ashx中使用Session

    在一般处理程序中给session赋值是报错:未将对象引用设置到对象的实例.

  3. Java transient 关键字

    1)一旦变量被transient修饰,变量将不再是对象持久化的一部分,该变量内容在序列化后无法获得访问. 2)transient关键字只能修饰变量,而不能修饰方法和类.注意,本地变量是不能被trans ...

  4. Distinct Subsequences

    https://leetcode.com/problems/distinct-subsequences/ Given a string S and a string T, count the numb ...

  5. bash学习

    if 的使用 declare -i x=10 if [ $x -lt 14 ];then echo $x'小于14'; elif [ $x -gt 9 ];then echo $x'大于9'; els ...

  6. 在Eclipse中集成Ant配置

    提要:本文将向你展示如何使用Eclipse设置为Ant所用的属性值和环境变量,并简要分析如何配置Ant编辑器以便从Eclipse内部操作Ant文件. 一. 修改Ant Classpath 在使用一个可 ...

  7. Html 5 Web Storage

    HTML5 中使用Web Storage 技术进行本地存储,能够在Web 客户端进行数据存储.WebStorage 曾今属于HTML5的规范,目前已经被独立出来形成单独的规范体系.简单来说使用Web本 ...

  8. Erlang--etc结构解析

    Erlang中可以用List表达集合数据,但是如果数据量特别大的话在List中访问元素就会变慢了;这种主要是由于List的绝大部分操作都是基于遍历完成的. Erlang的设计目标是软实时(参考:htt ...

  9. R语言 入门知识--常用操作和例子

    1 R的下载.安转   (转)R有很多的版本,支持目前主流的操作系统MAC.Linux和WINDOWS系列.因为我个人是在WINDOWS下用R的,所以在这里将只介绍WINDOWS下R的下载&安 ...

  10. XML 特殊字符

    XML转义字符 以下为XML标志符的数字和字符串转义符 "     (" 或 ") '     (' 或 ') &     (& 或 & ...