Centos shutdown and restart command detailed and actual combat
Linux centos restart command:
2, shutdown -r now restart immediately (used by the root user)
3, shutdown -r 10 automatically restart after 10 minutes (root user)
4, shutdown -r 20:35 restart at time 20:35 (used by the root user)
If you set the restart through the shutdown command, you can use the shutdown -c command to cancel the restart.
Linux centos shutdown command:
1, halt immediately shut down
2, poweroff shuts down immediately
3, shutdown -h now shut down immediately (used by the root user)
4, shutdown -h 10 automatically shut down after 10 minutes
If you set the shutdown through the shutdown command, you can use the shutdown -c command to cancel the restart.
The shutdown command safely shuts down the system. Some users will turn off Linux by directly disconnecting the power.
This is very dangerous. Because linux is different from windows, there are many processes running in the background, so forced shutdown may be
The data of the process will be lost, the system will be in an unstable state, and even in some systems, the hardware device will be damaged.
Using the shutdown command before the system is shut down, the system administrator will notify all logged-in user systems that they will be shut down.
And the login command will be frozen, ie the new user can no longer log in. Shut down directly or delay for a certain period of time
It is possible and it is possible to restart. This is the signal sent by the system from all processes.
decided. This allows programs like vi to have time to store the document that is currently being edited, like processing mail (mail) and
The news [news] program can leave normally and so on.
The shutdown to perform its job is to send a signal to the init program, asking it to change the runlevel.
Runlevel 0 is used to stop [halt], and runlevel 6 is used to reactivate the [reboot] system.
And runlevel 1 is used to let the system enter the state of management work; this is preset, assuming no -h
There is no -r parameter to shutdown. Want to know what to do during the shutdown or reboot process
Actions, you can see these runlevels related information in this file /etc/inittab.
Shutdown parameter description:
[-t] Tells init how long to shut down before changing to other runlevels.
[-r] Restart the calculator.
[-k] does not really shut down, just send a warning signal to each login [login].
[-h] Turn off the power [halt] after shutting down.
[-n] Instead of init, shut yourself down. This option is discouraged and the consequences of this option go
Not always what you expected.
[-c] cancel current process Cancel the shutdown program currently being executed. So of course this option is not
Time parameter, but you can enter a message for explanation, and this information will be sent to each user.
[-f] Ignore fsck when restarting the calculator [reboot].
[-F] Force fsck when restarting the calculator [reboot].
[-time] Set the time before shutdown [shutdown].
2.halt - the simplest shutdown command
In fact, halt is to call shutdown -h. When halt is executed, kill the application process and execute the sync system call.
The kernel is stopped after the file system write operation is completed.
[-n] Prevent sync system calls, it is used after patching the root partition with fsck to prevent the kernel from using the old version of the super
The superblock covers the patched superblock.
[-w] is not a real reboot or shutdown, just write wtmp[/var/log/wtmp] records.
[-d] Do not write wtmp records [included in option [-n]].
[-f] Forced shutdown or restart without calling shutdown.
[-i] Turn off all network interfaces before shutting down (or restarting).
[-p] This option is the default option. It is to call poweroff when shutting down.
The working process of reboot is almost the same as that of halt, but it causes the host to restart, and the halt is shutdown. it
The parameters are similar to those of halt.
Init is the ancestor of all processes, its process number is always 1, so sending a TERM signal to init will terminate all
User processes, daemons, etc. Shutdown is to use this mechanism. Init defines 8 runlevels.
Init 0 is the shutdown and init 1 is the restart. About init can be a long story, and it will not be described here. Moreover
The telinit command can change the run level of init. For example, telinit -iS can put the system into single-user mode.
And get the information and wait time when using shutdown.
How to change the root administrator password in Linux
Log in as root (SSH operation)
Enter the passwd command and you will be prompted to enter a new password.
CentOS Shutdown and restart command shutdown-r now reboot