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. C#高级编程笔记2016年10月12日 运算符重载

    1.运算符重载:运算符重重载的关键是在对象上不能总是只调用方法或属性,有时还需要做一些其他工作,例如,对数值进行相加.相乘或逻辑操作等.例如,语句if(a==b).对于类,这个语句在默认状态下会比较引 ...

  2. ngSanitize和$sce

    (angular-ngSanitize模块-$sanitize服务详解) 本篇主要讲解angular中的$sanitize这个服务.此服务依赖于ngSanitize模块. 要学习这个服务,先要了解另一 ...

  3. 设计模式--适配器模式Adapter(结构型)

    一.适配器模式 适配器模式的主要作用是在新接口和老接口之间进行适配.将一个类的接口转换成客户端期望的另外一个接口.其实适配器模式有点无赖之举,在前期设计的时候,我们就不应该考虑适配器模式,而应该通过重 ...

  4. 远程ssh登陆时报错:/bin/bash: Permission denied

    远程普通用户ssh登录时,提示/bin/bash: Permission denied,用户名mas,密码正确. 首先上个图,用户远程登录步骤,转自http://www.tldp.org/LDP/LG ...

  5. java反射

    知识点1:获取类字节码的三种形式 1.Class date = Date.class;//根据类名获取字节码 2.Date date= new Date(); date.getClass();//对象 ...

  6. tomcat虚拟路径

    目的:减小项目大小,方便部署和资源共享 tomcat/conf/server.xml host 标签中添加 p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: ...

  7. 不得不喷一下中控科技,ZKT,恶心的中控,售后技术和屎一样,半年不见人。

    要做一个指纹考勤机和后台通信写入到mysql.在淘宝看了好多款,于是决定用指纹考勤机w6.卖家当时说支持二次开发,给我发的sdk.于是买了一台测试.机器来了开始测试,使用发的demo不能使用,于是去中 ...

  8. ios .a和.framework

    创建Aggregate来合并模拟器和真机通用的framework 然后在Build Phases下New Run Script Phase创建合并脚本: # Constants SF_TARGET_N ...

  9. MVC Code First 当实体类发生变化时,如何自动更新数据库表

    下面做一个例子,Category是用户新建的一个实体类,然后添加一个字段,然后让数据库中的Category表也添加一个字段 1.Category.cs

  10. MVC判断用是否登录了平台

    需求就是要求有些页面需要用户登陆了之后才能访问,那么就需要是否登录验证,直接上代码: 这个可以单独写到一个类里面: WebAuthenUsers.cs: using System; using Sys ...