快速业务通道

linux关机详解

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-04-17

关机命令有三个halt,shutdown,poweroff,以及重启命令reboot
halt确有其命令,以及man内容.
shutdown也是专门负责关机的命令,并是独立的程序.
poweroff命令并不存在,但他直接调用的是halt -p的默认命令参数,是link过来的,下面我也提到了
reboot是重启命令,作用内容可以参考halt的man
......
[root@acnis root]# halt --help
usage: halt [-n] [-w] [-d] [-f] [-i] [-p]
-n: don''t sync before halting the system
-w: only write a wtmp reboot record and exit.
-d: don''t write a wtmp record.
-f: force halt/reboot, don''t call shutdown.
-p: power down the system (if possible, otherwise halt)
参数说明:
[-n] 防止 sync 系统调用,它用在用fsck修补根分区之后,以阻止内核用老版本的超级块(superblock)覆盖修补过的超级块.
[-w] 并不是真正的重启或关机,只是写 wtmp(/var/log/wtmp)纪录.
[-d] 不写 wtmp 纪录(已包含在选项 [-n] 中).
[-f] 没有调用 shutdown 而强制关机或"重启"(指的是reboot).
[-i] 关机(或重启)前,关掉所有的网络接口.
[-p] 该选项为缺省选项.就是关机时调用 poweroff. (isher喜欢直接用poweroff命令)
[-h] 在系统关闭之前,从系统中正确的移除所有的磁盘驱动器.
说明poweroff命令很多人不知道,这也是在/sbin下面的命令,是一个link,连接到halt -p的命令上.

[root@acnis sbin]# ll |grep pow
lrwxrwxrwx 1 root root 4 2002-01-13 poweroff -> halt

为了说明,MAN一下poweroff
MAN poweroff(halt) 得到以下内容,可以作为对照,对于halt -h
同时包含了halt命令和reboot的解释,poweroff本就是halt的快捷方式而已(windows的话)
NAME
halt, reboot, poweroff - stop the system.
SYNOPSIS
/sbin/halt [-n] [-w] [-d] [-f] [-i] [-p] [-h]
/sbin/reboot [-n] [-w] [-d] [-f] [-i]
/sbin/poweroff [-n] [-w] [-d] [-f] [-i] [-h]
OPTIONS
-n Don''t sync before reboot or halt.
-w Don''t actually reboot or halt but only write the wtmp record (in
the /var/log/wtmp file).
-d Don''t write the wtmp record. The -n flag implies -d.
-f Force halt or reboot, don''t call shutdown(8).
-i Shut down all network interfaces just before halt or reboot.
-h Put all harddrives on the system in standby mode just before
halt or poweroff.
-p When halting the system, do a poweroff. This is the default when
halt is called as poweroff.

[root@acnis root]# shutdown --help
shutdown: invalid option -- -
Usage: shutdown [-akrhfnc] [-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.
-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") **
参数说明
shutdown 命令可以安全地关闭或重启Linux系统,它在系统关闭之前给系统上的所有登录用户提示一条警告信息.该命令还允许用户指定一个时间参数,可以是一个精确 的时间,也可以是从现在开始的一个时间段.精确时间的格式是hh:mm,表示小时和分钟;时间段由“ ”和分钟数表示.系统执行该命令后,会自动进行数据同步的工作.
该命令的一般格式为: shutdown [选项] [时间] [警告信息] 命令中各选

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号