Shutdown shut down the system in a safe way. All login users can see the shutdown message, and login (1) will be blocked. You can specify immediate shutdown or system shutdown after a certain delay. All processes will receive SIGTERM signals. This allows time for programs such as vi (1) to store files in the editing state, mail and news program processes to properly clear all data in the buffer pool, and so on. Shutdown is achieved by notifying the init process to change its run level. Runlevel 0 is used to shut down the system, runlevel 6 is used to restart the system, and runlevel 1 is used to make the system enter the state of executing system management tasks. If the – H or – R flag is not given, this is the default working state of shutdown command. Please refer to the corresponding run level column in the / etc / inittab file for the specific operation of shutdown or restart.
Use / etc/ shutdown.allow To verify your identity.
It tells init (8) to send a warning signal and delay (SEC) seconds before switching to other operation levels, and then send a kill signal.
It is not a real shutdown, only a warning message is displayed to everyone.
[degraded] does not call init (8) program for shutdown operation, but by itself. Users are not recommended to use this shutdown method, and its results are generally not what you want.
Skip disk detection on restart.
Force disk detection on restart.
Cancels the shutdown process that is running. It is not possible to specify the time parameter for this option, but you can enter an explain message on the command line to explain it to all users. (the normal shutdown instruction can be interrupted by pressing the “+” sign)
Messages sent to all users.
There are many formats for the time parameter. First, it can be an absolute time in HH: mm format, where HH refers to hours (one to two digits) and mm refers to minutes (two digits). The second is the + m format, where m is the number of minutes to wait. Now is an alias for + 0.
If shutdown uses a delay when it is called, it will automatically create an advisory file / etc / nologin, which prevents login (1) from allowing new users to log in, unless shutdown aborts unexpectedly before signaling init (that is, it is cancelled or something goes wrong). It will delete the file before calling init to change the runlevel.
The logo means’ fast restart ‘. This creates an advisory file / FastBoot that will be detected when the system restarts. The startup script RC will detect whether such a file exists, and if so, fsck (1) will not be run again because the system is shut down in a normal way. After that, the boot process removes / FastBoot.
The flag means’ force fsck ‘. This creates an advisory file / forcefsck, which will be detected when the system restarts. The startup script RC will detect whether the file exists. If so, it will run fsck (1) and add a special ‘force’ flag to check even the normally unloaded file system. After that, the startup process removes / forcefsck.
-The N flag causes shutdown to shut down all running processes instead of calling the init program. Shutdown will then shut down quotas, accounting, and swap partitions, and unmount all file systems.
The code is as follows:
[ [email protected] ~]#Shutdown – h 23:00 ා shut down at 11:00 p.m
[ [email protected] ~]#Shutdown – r now ා restart
[ [email protected] ~]#Shutdown – R + 30 ‘reboot now’? Restart after 30 minutes and prompt reboot now
Halt [- n] [- w] [- D] [- F] [- I] [- P] Note: if the runlevel of the system is 0 or 6, the system will be shut down; otherwise, it will be replaced by the shutdown instruction (plus the – h parameter)
-Do not write data to the hard disk before shutting down
-W: it doesn’t really shut down. It just writes the records to the / var / log / wtmp file
-D: do not write records to / var / log / wtmp file (- n parameter contains – D) – F: force shutdown, do not call shutdown command
-I: stop all network related devices before shutting down
-P: when the power is off, do the power off action
The code is as follows:
Function Description: restart.
Grammar: dreboot [- dfinw]
Supplementary note: execute the reboot command to stop and restart the system.
– d do not write data to the log file / var / TMP / wtmp when rebooting. This parameter has the effect of the “- n” parameter.
– f forces a reboot without calling the shutdown command.
– I close all network interfaces before restarting.
– n do not check for open programs before restarting.
– W only tests, does not really restart the system, only writes the data of the restart to the wtmp log file in the / var / log directory.
The code is as follows: