Linux命令學習總結:shutdown
[[email protected] ~]# man shutdown
SHUTDOWN(8) Linux System Administrator鈥檚 Manual SHUTDOWN(8)
NAME
shutdown - bring the system down
SYNOPSIS
/sbin/shutdown [-t sec] [-arkhncfFHP] time [warning-message]
DESCRIPTION
shutdown brings the system down in a secure way. All logged-inusers 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 like
vi(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 to
halt the system, runlevel 6 is used to reboot the system, and runlevel 1 is used to put to system into a state
where administrative tasks can be performed; this is the defaultif 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 the
file /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, before
changing 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-message
Message 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 which
hh 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 as
login(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. After that, 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) with
a 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 then
turn off quota, accounting, and swapping and unmount all filesystems.
ACCESS CONTROL
shutdown 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. To 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 that
file with the list of people that are logged in on a virtual console (from /var/run/utmp). Only if one of those
authorized users or root is logged in, it will proceed. Otherwise it will write the message
shutdown: no authorized users logged in
to the (physical) system console. The format of /etc/shutdown.allow is one user name per line. Empty lines and
comment 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 POWEROFF
The -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 should
check these environment variables and call halt(8) with the right options for these options to actually have
any effect. Debian 3.1 (sarge) supports this.
FILES
/fastboot
/etc/inittab
/etc/init.d/halt
/etc/init.d/reboot
/etc/shutdown.allow
NOTES
A 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).
AUTHOR
Miquel van Smoorenburg, [email protected]
SEE ALSO
fsck(8), init(8), halt(8), poweroff(8), reboot(8)
November 12, 2003 SHUTDOWN(8)
(END)
相關推薦
Linux命令學習總結:shutdown
[[email protected] ~]# man shutdown SHUTDOWN(8) Linux System Administrator鈥檚 Manual SHUTDOWN(8) NAME shutdown - bring the
Linux命令學習總結:hexdump
命令簡介: hexdump是Linux下的一個二進位制檔案檢視工具,它可以將二進位制檔案轉換為ASCII、八進位制、十進位制、十六進位制格式進行檢視。 指令所在路徑:/usr/bin/hexdump
Linux命令學習總結:last
命令簡介: 該命令用來列出目前與過去登入系統的使用者相關資訊。指令英文原義:show listing of last logged in users 執行許可權 :有些需要特殊許
linux命令學習之:chmod
指令執行過程 rwx 屬於 col code linux系統中 相關 此外 相同 chmod命令用來變更文件或目錄的權限。在Linux系統家族裏,文件或目錄權限的控制分別以讀取R、寫入W、執行X3種一般權限來區分,另有3種特殊權限可供運用。用戶可以使用chmod指令去變
linux命令學習一 :touch和mkdir 建立檔案和資料夾
一、檢視命令詳情 touch --help mkdir --help 二、常用命令 1、建立檔案: touch filename 2、建立資料夾:mkdir directoryname 可建立父資料夾或建立多個或建立多級資料夾 mkdir -
linux命令學習總結
注意shell中萬用字元和正則表示式的區別 萬用字元:*表示任意的字元0-n個 正則: *表達*號前面的字元匹配0-n個 nohup command & 後臺執行 //
常用linux命令學習總結
檢視指定目錄下檔案大小 ls -lht logs/member*.log ls -ltr /dir 查詢最近15天內匹配的檔案並列出詳情 find logs/ -mtime -15 -name member*.log -ls find webapps/member/WEB-
linux命令學習(6):ps命令
bytes 釋放 ice cti width kthread hellip 名稱 pts Linux中的ps命令是Process Status的縮寫。ps命令用來列出系統中當前運行的那些進程。ps命令列出的是當前那些進程的快照,就是執行ps命令的那個時刻的那些進程,如果想要
Linux命令學習(17):ifconfig命令
廣播 參考 vip 統計 協議 cnblogs 還需要 pro 網絡 版權聲明更新:2017-05-22博主:LuckyAlan聯系:[email protected]/* */聲明:吃水不忘挖井人,轉載請註明出處! 1 文章介紹 我們知道,在windows中,
LInux初始學習篇:基本命令使用
基礎1、type、file命令的區別:(1)type :用於查看一條命令是內置命令還是外部命令使用格式:type command若是內部命令,顯示 builtin若是外部命令,顯示為命令文件路徑;例子:[root@VM_0_2_centos /]# type cdcd is a shell builti
Linux命令學習:
if=檔名:輸入檔名,預設為標準輸入。即指定原始檔。< if=input file > of=檔名:輸出檔名,預設為標準輸出。即指定目的檔案。< of=output file > ibs=bytes:一次讀入bytes個位元組,即指定一個塊大小為bytes個位元組。 obs=byte
Linux命令學習:Linux中more和less命令以及查詢用法
** 一、more命令 ** more功能類似 cat ,cat命令是整個檔案的內容從上到下顯示在螢幕上。 more會以一頁一頁的顯示方便使用者逐頁閱讀,而最基本的指令就是按空白鍵(space)就往下一頁顯示,按 b 鍵就會往回(back)一頁顯示,而且還有搜尋字串的功能 。mo
Linux命令學習:建立刪除檔案、資料夾的命令
今天學習了幾個命令,是建立、刪除檔案和資料夾的,在linux裡,資料夾是目錄,下面說下我學習的命令。 建立資料夾【mkdir】 一、mkdir命令使用許可權 所有使用者都可以在終端使用 mkdir
Linux常用命令學習總結
Windows連線Linux伺服器常用工具使用 winscp Winscp是Windows環境下的圖形化SFTP客戶端,同時支援SCP協議。主要功能是實現在本地與遠端計算機之間安全的複製檔案。winscp可連線Linux系統。 SecureCRT Windows下
Linux學習總結:特殊許可權SUID,SGID,SBIT
目錄 一、SUID 二、SGID 三、SBIT Linux中除了rwx許可權外,另外還有三種特殊許可權:SUID、SGID、SBIT 假如本來在該位上有x, 則這些特別標誌 (SUID, SGID,SBIT)顯示為小寫字母 (s,s,t)。否則顯示為大寫字母 (S,S,T) 。在
Linux學習總結:特殊權限SUID,SGID,SBIT
sgid 進行 註意 權力 添加 linux中 動作 限制 字母 目錄 一、SUID 二、SGID 三、SBIT Linux中除了rwx權限外,另外還有三種特殊權限:SUID、SGID、SBIT 假如本來在該位上有x,?則這些特別標誌 (SUID,?SGID,SBIT)顯示
必須掌握的Linux系統命令學習總結
一、基礎概念 1、系統核心: 計算機硬體是有運算器、控制器、儲存器、輸入輸出裝置等共同組成,而讓各種硬體裝置各司其職且又能協同執行的東西就是系統核心,Linux系統的核心負責完成對硬體資源的分配、排程等管理任務。系統核心對計算機正常執行來說太重要,一般不建議
linux重定向總結:如何將shell命令的輸出資訊自動輸出到檔案中儲存
在做批量實驗室,例如跑批量MR的作業,我們會寫好shell指令碼,然後啟動指令碼,等所有作業執行完再去看結果,但是這些執行時的資訊如何儲存下來到檔案中呢?下面這個命令可以完成這個任務。 sh batchjob.sh 2>&1 | tee mylog.log
12_23學習linux命令的總結
1:.代表當前目錄;..代表上一級目錄; 2:啟動應用程式時:./xx; 3:刪除檔案的命令:rm -tf xx ; 4:建立目錄的命令:mkdir xx; 5 : 建立別名的命令:ln -s &{dest}/bin gcc gcc34 6 : 更新源的命令: su
linux命令學習(3):pwd命令
Linux中用 pwd 命令來檢視”當前工作目錄“的完整路徑。 簡單得說,每當你在終端進行操作時,你都會有一個當前工作目錄。 在不太確定當前位置時,就會使用pwd來判定當前目錄在檔案系統內的確切位置。 1.命令格式: pwd [選項] 2.命令功能: