Linux关机命令

1.shutdow n
shutdown命令安全地将系统关机。

有些用户会使用直接断掉电源的方式来关闭linux,这是十分危险的。

因为linux与windows不同,其后台运行着许多进程,所以强制关机可能会导致进程的数据丢失﹐使系统处于不稳定的状态﹐甚至在有的系统中会损坏硬件设备。

而在系统关机前使用shutdown命令﹐系统管理员会通知所有登录的用户系统将要关闭。

并且login指令会被冻结﹐即新的用户不能再登录。

直接关机或者延迟一定的时间才关机都是可能的﹐还可能重启。

这是由所有进程〔process〕都会收到系统所送达的信号〔signal〕决定的。

这让像v i之类的程序有时间储存目前正在编辑的文档﹐而像处理邮件〔mail〕和新闻〔news〕的程序则可以正常地离开等等。

shutdown执行它的工作是送信号〔signal〕给init程序﹐要求它改变runlevel。

Runlevel 0被用来停机〔halt〕﹐runlevel 6是用来重新激活〔reboot〕系统﹐而runlevel 1则是被用来让系统进入管理工作可以进行的状态﹔这是预设的﹐假定没有-h也没有-r参数给shutdown。

要想了解在停机〔halt〕或者重新开机〔reboot〕过程中做了哪些动作﹐你可以在这个文件/etc/inittab里看到这些runlevels相关的资料。

shutdow n 参数说明:
[-t] 在改变到其它runlevel之前﹐告诉init多久以后关机。

[-r] 重启计算器。

[-k] 并不真正关机﹐只是送警告信号给每位登录者〔login〕。

[-h] 关机后关闭电源〔halt〕。

[-n] 不用init﹐而是自己来关机。

不鼓励使用这个选项﹐而且该选项所产生的后果往往不总是你所预期得到的。

[-c] c ancel current process取消目前正在执行的关机程序。

所以这个选项当然没有时间参数﹐但是可以输入一个用来解释的讯息﹐而这信息将会送到每位使用者。

[-f] 在重启计算器〔reboot〕时忽略fsc k。

[-F]在重启计算器〔reboot〕时强迫fsck。

[-time] 设定关机〔shutdown〕前的时间。

2.halt----最简单的关机命令
其实halt就是调用shutdow n -h。

halt执行时﹐杀死应用进程﹐执行sync系统调用﹐文件系统写操作完成后就会停止内核。

参数说明:
[-n] 防止sync系统调用﹐它用在用fsck修补根分区之后﹐以阻止内核用老版本的超级块〔superbloc k〕覆盖修补过的超级块。

[-w]并不是真正的重启或关机﹐只是写w tmp〔/var/log/wtmp〕纪录。

[-d] 不写wtmp纪录〔已包含在选项[-n]中〕。

[-f] 没有调用shutdow n而强制关机或重启。

[-i] 关机〔或重启〕前﹐关掉所有的网络接口。

[-p] 该选项为缺省选项。

就是关机时调用poweroff。

3.reboot
reboot的工作过程差不多跟halt一样﹐不过它是引发主机重启﹐而halt是关机。

它的参数与halt相差不多。

4.init
init是所有进程的祖先﹐它的进程号始终为1﹐所以发送TERM信号给init会终止所有的用户进程﹑守护进程等。

shutdow n 就是使用这种
机制。

init定义了8个运行级别(runlevel),init 0为关机﹐init 1为重启。

关于init可以长篇大论﹐这里就不再叙述。

另外还有telinit命令可以改变init的运行级别﹐比如﹐telinit -iS可使系统进入单用户模式﹐并且得不到使用shutdown时的信息和等待时间。

合集下载

linux下最常用的关机命令 -回复

linux下最常用的关机命令 -回复

linux下最常用的关机命令-回复Linux是一种开源的操作系统,广泛用于服务器和个人电脑。

关机是每个电脑用户都会经历的过程,而在Linux中,也有一些常用的命令来完成关机操作。

本文将一步一步回答"Linux下最常用的关机命令"这一主题。

一、通过命令行关闭电脑在Linux中,我们可以通过命令行来控制关机。

以下是最常用的几个关机命令:1. 关机命令:shutdown- 语法:shutdown [选项] [时间] [警告消息]- 示例:shutdown -h now- 解释:这个命令会立即关闭计算机,并向所有用户发送一条关机警告消息。

2. 重启命令:reboot- 语法:reboot- 示例:reboot- 解释:这个命令会重启计算机,关闭所有的进程,并重新启动系统。

3. 立即关机命令:poweroff- 语法:poweroff- 示例:poweroff- 解释:这个命令会立即关闭计算机,无论是否有未保存的数据。

4. 取消关机命令:halt- 语法:halt- 示例:halt- 解释:这个命令会关闭计算机,但不会切断电源。

使用这个命令可以安全地关闭计算机,而不会丢失数据。

5. 指定关机时间命令:shutdown- 语法:shutdown [选项] 时间- 示例:shutdown -h 10:30- 解释:这个命令会在指定的时间(10:30)关机。

二、关机命令的选项和参数除了上述常用的关机命令外,关机命令还支持一些选项和参数,以满足用户不同的需求。

1. 选项- -h:关机后断电。

- -r:关机后重新启动。

- -c:取消关机操作。

- -k:仅向所有用户发送关机警告消息,而不进行真正的关机操作。

2. 时间参数- now:立即关机。

- +m:在m分钟内关机。

- hh:mm:在指定的时刻关机。

三、使用示例以下是一些实际示例,演示如何使用关机命令来完成关机操作。

1. 立即关机:- 命令:shutdown -h now- 解释:立即关闭计算机,并向所有用户发送关机警告消息。

LinuxCentOS7.X-关机、重启命令

LinuxCentOS7.X-关机、重启命令

LinuxCentOS7.X-关机、重启命令⼀、命令操作1、退出命令 退出登陆命令:logout;2、关闭命令 ⽴即关机:shutdown -h now(root⽤户) halt poweroff 延时关机:shutdown -h minute,其中minute为延时的分钟数(root⽤户),如:shutdown -h 10 10分钟后⾃动关机3、重启命令 重启服务器命令:reboot 普通重启 shutdown -r now ⽴即重启(root⽤户) shutdown -r minute 其中minute为延时的分钟数(root⽤户)。

如:shutdown -r 10,过10分钟⾃动重启 shutdown -r time 其中time为关机时间(root⽤户)。

如:shutdown -r 20:35 在时间为20:35时候重启4、sync把内存的数据同步到磁盘上 注意: a)如果是通过shutdown命令设置关机、重启的话,可以⽤shutdown -c命令取消关机、重启; b)不管是重启系统还是关闭系统,⾸先运⾏sync命令,把内存中的数据写⼊到磁盘中; c)登⼊时尽量少⽤root账号登⼊,因是系统管理员,最⼤的权限,避免操作失误。

可以利⽤普通⽤户登⼊,登⼊后再⽤su - ⽤户名命令来切换成具备系统管理员⾝份的⽤户。

当从权限⾼的⽤户切换到权限低的⽤户,不需要输⼊密码,反之需要,当需要返回 到原来⽤户时,使⽤exit指令。

⼆、命令说明 1.shutdown 参数说明: [-t] 在改变到其它runlevel之前﹐告诉init多久以后关机。

[-r] 重启计算器。

[-k] 并不真正关机﹐只是送警告信号给每位登录者〔login〕。

[-h] 关机后关闭电源〔halt〕。

[-n] 不⽤init﹐⽽是⾃⼰来关机。

不⿎励使⽤这个选项﹐⽽且该选项所产⽣的后果往 往不总是你所预期得到的。

[-c] cancel current process取消⽬前正在执⾏的关机程序。

Linux终端中的系统关机和重启命令

Linux终端中的系统关机和重启命令

Linux终端中的系统关机和重启命令Linux作为一种开源的操作系统,具有很高的灵活性和自定义性。

在使用Linux终端时,系统关机和重启是经常涉及到的操作。

本文将介绍Linux终端中常用的系统关机和重启命令,供用户参考和使用。

1. 关机命令在Linux终端中,通过使用特定的关机命令可以实现系统的安全关机,保证数据的完整性,避免出现数据丢失或损坏的情况。

下面是常用的关机命令及其用法:1.1. shutdown命令shutdown命令可实现系统的关机操作,并向所有登录用户发送关机通知。

命令格式如下:```shutdown [选项] 时间 [警告信息]```常用选项:- -r: 关机后立即重启系统- -h: 关机后不重启系统- -c: 取消已经设置的关机操作- -t seconds: 设置关机前的等待时间(以秒为单位)示例:```shutdown -h now # 立即关机shutdown -h +10 # 10分钟后关机shutdown -r 20:00 # 指定时间关机并重启shutdown -c # 取消当前关机操作```1.2. poweroff命令poweroff命令负责关闭电源,可以用来执行硬件完全关机,对电源断电。

命令格式如下:```poweroff```示例:```poweroff```1.3. halt命令halt命令用于停止系统运行,并使计算机进入停止状态。

命令格式如下:```halt```示例:```halt```1.4. init命令init命令用于改变系统的运行等级,其中运行等级0为关机状态,通常用init命令实现关机操作。

命令格式如下:```init [运行等级]```示例:```init 0```2. 重启命令有时候需要重启系统以应用修改或解决一些问题。

在Linux终端中,可以使用以下命令实现系统的重启:2.1. reboot命令reboot命令用于重启系统,它会关闭所有正在运行的进程,并重新引导计算机。

linux虚拟机关机、重启命令

linux虚拟机关机、重启命令

linux虚拟机关机、重启命令linux虚拟机关机、重启命令2018-08-20 14:10:31 53806 收藏 101⼀.shutdown1.shutdown -h now :⽴即关机2.shutdown -h 10:53:到10:53关机3.shutdown -h +10 :10分钟后⾃动关机4.shutdown -r :重启(默认30秒)5.shutdown -r now :⽴即重启6.shutdown -r +30 :’The System Will Reboot 30 in Mins’:30分钟后重启并发送通知给其他在线⽤户7.shutdown -s -t 100 :延迟100秒关机8.shutdown -a :取消上⾯的关机、重启⼆、reboot1.reboor :重启,相当于shutdown -r now2.reboot -d :重新启动时不把数据写⼊记录⽂件 /var/tmp/wtmp3.reboot -f :强制重新开机4.reboot -h:在系统关机之前,将所有的硬盘处于待机模式下5.reboot -i :关闭⽹络设置之后再重新启动系统6.reboot -n :保存数据后重启三、halt1.halt :关机2.halt -d :关闭系统,不把记录写到/var/log/wtmp⽂件⾥3.halt -p :关机并关闭电源4.halt -f :强制关机四、init1.init 0 :关机2.0-6:表⽰系统运⾏的7个级别0:关机级别1:单⽤户级别,运⾏rc.sysinit和rc1.d⽬录下的脚本2:多⽤户,但系统不会启动NFS,字符模式3:多⽤户,字符模式,系统启动具有⽹络功能4:⽤户⾃定义级别5:图形界⾯模式6:重启级别五、poweroff1.poweroff :关机并关闭电源2.poweroff -p:关机并关闭电源3.poweroff -f :强制关机4.poweroff -w:不是真正的关机,只是将数据写⼊到/var/log/wtmp⽂件⾥六、按Ctrl + Alt + Delete键—- 选择关机。

linux系统下重启系统、关闭系统、注销系统等相关命令操作

linux系统下重启系统、关闭系统、注销系统等相关命令操作

linux系统下重启系统、关闭系统、注销系统等相关命令操作1.KDE快捷键1.KDE快捷键Alt+F1--弹出KDE菜单Alt+F2--弹出“运行"窗口2.用户注销在文字终端中,可以通过下面两种方式:.Exit或Logout.Ctrl+D组合键3.Linux操作系统的关闭与重启init 0:关机,且如果处于多用户模式,不会通知其他用户halt:与init 0类似,但它不会关闭计算机,用户可以Resetshutdown +10:10分钟后关闭计算机shutdown 23:00--23:00关闭计算机,无广播1.shutdownshutdown命令安全地将系统关机。

有些用户会使用直接断掉电源的方式来关闭linux,这是十分危险的。

因为linux与windows不同,其后台运行着许多进程,所以强制关机可能会导致进程的数据丢失o使系统处于不稳定的状态o甚至在有的系统中会损坏硬件设备。

而在系统关机前使用shutdown命令o系统管理员会通知所有登录的用户系统将要关闭。

并且login指令会被冻结o即新的用户不能再登录。

直接关机或者延迟一定的时间才关机都是可能的o还可能重启。

这是由所有进程〔process〕都会收到系统所送达的信号〔signal〕决定的。

这让像vi之类的程序有时间储存目前正在编辑的文档o而像处理邮件〔mail〕和新闻〔news〕的程序则可以正常地离开等等。

shutdown执行它的工作是送信号〔signal〕给init程序o要求它改变runlevel。

Runlevel 0被用来停机〔halt〕orunlevel 6是用来重新激活〔reboot〕系统o而runlevel 1则是被用来让系统进入管理工作可以进行的状态r这是预设的o假定没有-h也没有-r参数给shutdown。

要想了解在停机〔halt〕或者重新开机〔reboot〕过程中做了哪些动作o你可以在这个文件/etc/inittab 里看到这些runlevels相关的资料。

linux关机命令init

linux关机命令init

linux关机命令initlinux下我们可以通过相关的命令来关闭计算机,下面由店铺为大家整理了linux关机命令init的相关知识,希望大家喜欢!linux关机命令——init一、linux关机命令init说明所谓的init进程,它是一个由内核启动的用户级进程。

内核自行启动(已经被载入内存,开始运行,并已初始化所有的设备驱动程序和数据结构等)之后,就通过启动一个用户级程序init的方式,完成引导进程。

所以,init始终是第一个进程(其进程编号始终为1)。

内核会在过去曾使用过init的几个地方查找它,它的正确位置(对Linux系统来说)是/sbin/init。

如果内核找不到init,它就会试着运行/bin/sh,如果运行失败,系统的启动也会失败。

二、linux关机命令init运行级别简单的说,运行级就是操作系统当前正在运行的功能级别。

这个级别从1到6 ,具有不同的功能。

不同的运行级定义如下:(可以参考Red Hat Linux 里面的/etc/inittab)# 0 - 停机(千万不能把initdefault 设置为0 )# 1 - 单用户模式# 2 - 多用户,没有 NFS# 3 - 完全多用户模式(标准的运行级)# 4 - 没有用到# 5 - X11 (xwindow)# 6 - 重新启动 (千万不要把initdefault 设置为6 )这些级别在/etc/inittab 文件里指定。

这个文件是init 程序寻找的主要文件,最先运行的服务是放在/etc/rc.d 目录下的文件。

在大多数的Linux 发行版本中,启动脚本都是位于/etc/rc.d/init.d中的。

这些脚本被用ln 命令连接到 /etc/rc.d/rcn.d 目录。

(这里的n 就是运行级0-6)三、linux关机命令init运行级别的配置运行级别的配置是在/etc/inittab行内进行的,如下所示:12 : 2 : wait : / etc / init.d / rc 2第一个字段是一个任意指定的标签;第二个字段表示这一行适用于运行那个级别(这里是2);第三个字段表示进入运行级别时,init应该运行第四个字段内的命令一次,而且init应该等待该命令结束。

Linux关机命令分析

Linux关机命令分析linux下有关关机重启的命令主要有:shutdown、reboot、halt、poweroff、telinit、init。

它们都可以达到关机或重启的目的,但是每个命令的工作流程并不一样。

它们都由软件包sysvinit生成,你可以从网上下载它的源码来分析各个命令的流程,同时,sysvinit也包含了与登陆等有关的命令。

下面分析sysvinit-2.86软件包的源码,同时参考它们的手册来对它们深入了解。

1、从Makefile可以知道,上面的命令并不都是互相独立的,poweroff、reboot是halt 的链接,telinit是init的链接。

ln -sf halt $(ROOT)/sbin/rebootln -sf halt $(ROOT)/sbin/poweroffln -sf init $(ROOT)/sbin/telinit在终端输入# ls -l /sbin/poweroff# ls -l /sbin/reboot# ls -l /sbin/telinit也可以看到上面的结果。

2、halt。

参数说明:[-n] 防止sync系统调用﹐它用在用fsck修补根分区之后﹐以阻止内核用老版本的超级块〔superblock〕覆盖修补过的超级块。

[-w] 并不是真正的重启或关机﹐只是写wtmp〔/var/log/wtmp〕纪录。

[-d] 不写wtmp纪录〔已包含在选项[-n]中〕。

[-f] 没有调用shutdown而强制关机或重启(halt/reboot)。

[-h] 使硬盘处于standby模式。

[-i] 关掉所有的网络接口。

[-p] 该选项为缺省选项。

就是关机时调用poweroff。

前面已经知道,poweroff、reboot是halt的链接,halt会首先判断用户执行的是否是poweroff和reboot中的一个。

如果执行的是poweroff,则等效于-p参数,执行reboot 的情况将在下面说明。

linux虚拟机关机、重启命令

linux虚拟机关机、重启命令linux虚拟机关机、重启命令⼀.shutdown1.shutdown -h now :⽴即关机2.shutdown -h 10:53:到10:53关机3.shutdown -h +10 :10分钟后⾃动关机4.shutdown -r :重启(默认30秒)5.shutdown -r now :⽴即重启6.shutdown -r +30 :’The System Will Reboot 30 in Mins’:30分钟后重启并发送通知给其他在线⽤户7.shutdown -s -t 100 :延迟100秒关机8.shutdown -a :取消上⾯的关机、重启⼆、reboot1.reboor :重启,相当于shutdown -r now2.reboot -d :重新启动时不把数据写⼊记录⽂件 /var/tmp/wtmp3.reboot -f :强制重新开机4.reboot -h:在系统关机之前,将所有的硬盘处于待机模式下5.reboot -i :关闭⽹络设置之后再重新启动系统6.reboot -n :保存数据后重启三、halt1.halt :关机2.halt -d :关闭系统,不把记录写到/var/log/wtmp⽂件⾥3.halt -p :关机并关闭电源4.halt -f :强制关机四、init1.init 0 :关机2.0-6:表⽰系统运⾏的7个级别0:关机级别1:单⽤户级别,运⾏rc.sysinit和rc1.d⽬录下的脚本2:多⽤户,但系统不会启动NFS,字符模式3:多⽤户,字符模式,系统启动具有⽹络功能4:⽤户⾃定义级别5:图形界⾯模式6:重启级别五、poweroff1.poweroff :关机并关闭电源2.poweroff -p:关机并关闭电源3.poweroff -f :强制关机4.poweroff -w:不是真正的关机,只是将数据写⼊到/var/log/wtmp⽂件⾥六、按Ctrl + Alt + Delete键—- 选择关机。

linux服务器关机、重启、注销命令

linux服务器关机、重启、注销命令管理员root用户下执行命令。

1关机命令 shutdown好像ubuntu的终端中默认的是当前用户的命令,只是普通用户,因此在终端器中可以使用sudo -sh 转换到管理员root用户下执行命令。

1)shutdown –help可以查看shutdown命令如何使用,当然也可以使用man shutdown命令。

2) shutdown -h now 现在立即关机 3)shutdown -r now 现在立即重启 4)shutdown -r +3 三分钟后重启5)shutdown -h +3 “The System will shutdown after 3 minutes”提示使用者将在三分钟后关机6)shutdown -r 20:23 在20:23时将重启计算机7)shutdown -r 20:23 & 可以将在20:23时重启的任务放到后台去,用户可以继续操作终端2中断命令1)执行完命令后(若没有转到后台),可以使用CTRL+C来中止命令 2)kill 程序编码当命令在后台执行时系统会返回一个程序编码,例如:在使用 shutdown -r 20:23 & 系统返回系统编码:4905我们可以使用kill 4905来中止重启命令 3ps aux | grep 程序编号我们如果知道程序的编号,我们可以使用ps aux |grep 程序编号来查询该程序编号对应的命令是什么。

例如上面的程序编号为4905 ,我们可以使用ps aux | grep 4905 就可以查到 shutdown -r 20:23 & 的命令halt—-最简单的关机命令其实halt就是调用shutdown -h。

halt执行时﹐杀死应用进程﹐执行sync系统调用﹐文件系统写操作完成后就会停止内核。

参数说明:[-n] 防止sync系统调用﹐它用在用fsck修补根分区之后﹐以阻止内核用老版本的超级块〔superblock〕覆盖修补过的超级块。

linux的shutdown命令详解

linux的shutdown命令详解linux下关机我们可以采用shutdown命令来实现,下面由店铺为大家搜集整理了linux的shutdown命令详解的相关知识,希望对大家有帮助!linux的shutdown命令详解命令简介:该命令可以安全关闭或者重新启动系统。

你没有看错,shutdown 命令不仅可以关闭系统、也可以重启Linux系统。

命令语法:/sbin/shutdown [-t sec] [-arkhncfFHP] time [warning-message]命令参数:参数长参数描叙-a Use /etc/shutdown.allow.-c中断关机:当执行"shutdown -h 12:00"指令时,只要按+键就可以中断关机的指令-f重新启动时不进行磁盘检测(fsck)-F重新启动时进行磁盘检测(fsck)-h关闭电源-k模拟关机(不是真的关机),只是向登录者发送警告信息出去!-n不调用init进程进行关机,而是强行关机-r关闭系统然后重新启动,类似于Windows平台restart-t延迟关机的时间-w仅做测试,并不真的将系统重新开机,只会把重开机的数据写入/var/log目录下的wtmp记录文件--help显示命令在线帮助linux的shutdown命令使用示例1: 查看reboot命令的帮助信息[root@db-server ~]# shutdown --helpshutdown: invalid option -- -Usage: shutdown [-akrhHPfnc] [-t secs] time [warning message]-a: use /etc/shutdown.allow-k: don't really shutdown, only warn.-r: reboot after shutdown.-h: halt after shutdown.-P: halt action is to turn off power.-H: halt action is to just halt.-f: do a 'fast' reboot (skip fsck).-F: Force fsck on reboot.-n: do not go through "init" but go down real fast.-c: cancel a running shutdown.-t secs: delay between warning and kill signal.** the "time" argument is mandatory! (try "now") **[root@db-server ~]#[root@db-server ~]# man shutdownSHUTDOWN(8) Linux System Administrator鈥檚Manual SHUTDOWN(8)NAMEshutdown - bring the system downSYNOPSIS/sbin/shutdown [-t sec] [-arkhncfFHP] time [warning-message]DESCRIPTIONshutdown brings the system down in a secure way. All logged-in users are notified that the system is going down, and login(1) is blocked. It is possible to shut the system down immediately or after a specified delay.All processes are first notified that the system is going down by the signal SIGTERM. This gives programs likevi(1) the time to save the file being edited, mail and news processing programs a chance to exit cleanly, etc.shutdown does its job by signalling the init process, asking it to change the runlevel. Runlevel 0 is used tohalt the system, runlevel 6 is used to reboot the system, and runlevel 1 is used to put to system into a statewhere administrative tasks can be performed; this is the default if neither the -h or -r flag is given to shut-down. To see which actions are taken on halt or reboot see the appropriate entries for these runlevels in thefile /etc/inittab.OPTIONS-a Use /etc/shutdown.allow.-t sec Tell init(8) to wait sec seconds between sending processes the warning and the kill signal, beforechanging to another runlevel.-k Don鈥檛really shutdown; only send the warning messages to everybody.-r Reboot after shutdown.-h Halt or poweroff after shutdown.-H Halt action is to halt or drop into boot monitor on systems that support it.-P Halt action is to turn off the power.-n [DEPRECATED] Don鈥檛call init(8) to do the shutdown but do it ourself. The use of this option is dis-couraged, and its results are not always what you鈥檇 expect.-f Skip fsck on reboot.-F Force fsck on reboot.-c Cancel an already running shutdown. With this option it is of course not possible to give the time argu-ment, but you can enter a explanatory message on the command line that will be sent to all users.time When to shutdown.warning-messageMessage to send to all users.The time argument can have different formats. First, it can be an absolute time in the format hh:mm, in whichhh is the hour (1 or 2 digits) and mm is the minute of the hour (in two digits). Second, it can be in the for-mat +m, in which m is the number of minutes to wait. The word now is an alias for +0.If shutdown is called with a delay, it creates the advisory file /etc/nologin which causes programs such aslogin(1) to not allow new user logins. Shutdown removes this file if it is stopped before it can signal init(i.e. it is cancelled or something goes wrong). It also removes it before calling init to change the runlevel.The -f flag means 鈥榬eboot fast鈥? This only creates an advisory file /fastboot which can be tested by the sys- tem when it comes up again. The boot rc file can test if this file is present, and decide not to run fsck(1)since the system has been shut down in the proper way. Afterthat, the boot process should remove /fastboot.The -F flag means 鈥榝orce fsck鈥? This only creates an advisory file /forcefsck which can be tested by the sys- tem when it comes up again. The boot rc file can test if this file is present, and decide to run fsck(1) witha special 鈥榝orce鈥?flag so that even properly unmounted filesystems get checked. After that, the boot process should remove /forcefsck.The -n flag causes shutdown not to call init, but to kill all running processes itself. shutdown will thenturn off quota, accounting, and swapping and unmount all filesystems.ACCESS CONTROLshutdown can be called from init(8) when the magic keys CTRL-ALT-DEL are pressed, by creating an appropriate entry in /etc/inittab. This means that everyone who has physical access to the console keyboard can shut the system down. T o prevent this, shutdown can check to see if an authorized user is logged in on one of the vir-tual consoles. If shutdown is called with the -a argument (add this to the invocation of shutdown in /etc/init-tab), it checks to see if the file /etc/shutdown.allow is present. It then compares the login names in thatfile with the list of people that are logged in on a virtual console (from /var/run/utmp). Only if one of thoseauthorized users or root is logged in, it will proceed. Otherwise it will write the messageshutdown: no authorized users logged into the (physical) system console. The format of /etc/shutdown.allow is one user name per line. Empty lines andcomment lines (prefixed by a #) are allowed. Currently there is a limit of 32 users in this file.Note that if /etc/shutdown.allow is not present, the -a argument is ignored.HALT OR POWEROFFThe -H option just sets the init environment variable INIT_HALT to HALT, and the -P option just sets that vari- able to POWEROFF. The shutdown script that calls halt(8) as the last thing in the shutdown sequence shouldcheck these environment variables and call halt(8) with the right options for these options to actually haveany effect. Debian 3.1 (sarge) supports this.FILES/fastboot/etc/inittab/etc/init.d/halt/etc/init.d/reboot/etc/shutdown.allowNOTESA lot of users forget to give the time argument and are then puzzled by the error message shutdown produces.The time argument is mandatory; in 90 percent of all cases this argument will be the word now.Init can only capture CTRL-ALT-DEL and start shutdown in console mode. If the system is running the X window System, the X server processes all key strokes. Some X11 environments make it possible to capture CTRL-ALT-DEL, but what exactly is done with that event depends on that environment.Shutdown wasn鈥檛designed to be run setuid./etc/shutdown.allow is not used to find out who is executing shut-down, it ONLY checks who is currently logged in on (one of the) console(s).AUTHORMiquelvanSmoorenburg,******************SEE ALSOfsck(8), init(8), halt(8), poweroff(8), reboot(8)November 12, 2003 SHUTDOWN(8)(END)2:马上关闭Linux系统,其中 now 相当于时间为 0 的状态[root@db-server ~]# shutdown -h nowBroadcast message from root (pts/1) (Sat Jan 10 18:51:34 2015):The system is going down for system halt NOW!3:系统2分钟后重新启动,其中+m表示几分钟后关机或开机。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
相关文档
最新文档