shutdown - shut down the system

Overview SYNOPSIS

/sbin/shutdown [-t sec] [-arkhncfF] time [warning-message]

Description DESCRIPTION

shutdown in a secure way to shut down the system. All logged-in user can see the information prompted the shutdown, and the Login (1) will be blocked. You can specify immediately shut down, you can also specify that the system shut down after a certain delay. All processes will receive the SIGTERM signal. This allows vi (1) and other procedures will be in time to edit the state file storage, mail and news programs you can process all of the data buffer pool appropriately cleared and so on. shutdown by notifying the init process, asking it to change run levels to achieve. Run level 0 to turn off the system, runlevel 6 is used to reboot the system, run level 1 to bring the system to perform system administration tasks status, if not given -h or -r flag is specified, this is the shutdown default work order status . Specific shutdown or restart operation performed please refer to the / etc / inittab file in the appropriate run level bar.

Options OPTIONS

-a
Use /etc/shutdown.allow to verify identity.
-t sec
Notification init delay ((8) before switching to the other operating level, sending a warning (warning) signal sec ) seconds before sending off (the kill) signal.
-k
It is not really shutdown, only a warning message to all.
-r
Restart.
-h
Stop.
-n
[DEPRECATED (should not be used)] without calling the init (. 8) shutdown program, performed by themselves. Not recommended to use this shutdown mode, it is generally not the result you hoped.
-f
Skip disk detection restart.
-F
Forced fsck restart.
-c
Cancel the shutdown process running. This option can not be specified time parameters, but you can explain in a command line message clear to all users. (Normal shutdown instructions may press the "+" sign to an interrupt)
time
Off time.
warning-message
All messages sent to the user.


time format argument can have a variety. First, it can be hh: mm absolute time format, where hh refers to hour (one or two digits), mm refers to minutes (two digits). The second is + m format, wherein m refers to the number of minutes to wait. now is +0 alias.

If the shutdown using a delay when you call, it will automatically create a consultative (advisory) file / etc / nologin , the role is to prohibit login (1) allows new users to log in, unless shutdown unexpected termination before init signal to (that is to say it was canceled or what's wrong). It will delete the file before calling init to change run levels.

-f flag means `reboot fast '. This will create an advisory (advisory) file / fastboot , this file system restart will be detected. The boot rc detects the existence of such documents, if any, will not run fsck (1), because the system is shutting down properly. After that, the boot process should remove / fastboot .

-F flag means `force the fsck '. This will create an advisory (advisory) file / forcefsck , the file system restart will be detected. The boot rc detect the presence of this file, if so, run fsck (1) and adds a special `force 'flag so that even properly unmounted file system has also been checked. After that, the boot process should remove / forcefsck .


-n flag causes shutdown not to call init program to shut down, but his close all running processes. shutdown next will close quota (quota), accounting (accounting) and swap partitions, uninstall all file systems.

Access Control ACCESS CONTROL

If the / etc / inittab appropriate entry in the file, when a special key is pressed CTRL-ALT-DEL time, the shutdown may be init call (8). This means that anyone can physically contact the terminal keyboard can shut down the system. To avoid this behavior, the shutdown can detect whether an authorized user to log on to one of the virtual terminal. If the shutdown When called -a (it can add parameters to / etc / inittab after the shutdown command execution), it will detect the presence of /etc/shutdown.allow file. Then login user login name list it compare files and virtual terminal (in / var / RUN / utmp ). Only when one of the authorized users or root is logged in, it will continue. Otherwise, it will information

 

shutdown: no authorized users logged in

Write (physical) system terminal. /etc/shutdown.allow format is a user name per line. Allowed blank lines and comment lines (with # at the beginning). This file is currently limited up to 32 users.

Note that if /etc/shutdown.allow does not exist, -a parameter is ignored.

FILES file

/fastboot
/etc/inittab
/etc/init.d/halt
/etc/init.d/reboot
/etc/shutdown.allow

Note NOTES

Many users forget the passing time parameters, the result was shutdown confused by the error messages generated. time parameter is required, 90% of the cases this parameter is now .

Init can only capture CTRL-ALT-DEL terminal mode and starts shutdown. If your system is running X window System, X server handles all the keys. Some X11 environment enables capture CTRL-ALT-DEL possible, but this event actually done anything that depends on the environment.

Shutdown was not designed to use setuid. /etc/shutdown.allow do not have to find out who is to perform the shutdown , it * only * be used to check the user's current terminal (one of) login. 

Guess you like

Origin www.cnblogs.com/fanweisheng/p/11098648.html