Linux system centos shutdown and restart command detailed

  
 

About Linux shutdown and restart commands. In fact, the first article should write about Linux installation and hard disk partitioning. I believe that the most important part of Linux interface installation is the hard disk partition. This is completely different from Windows
, so I will use it next time. >Tutorials
Additional! Let me talk about Linux shutdown and restart this time!

Linux centos restart command: 1, reboot2, 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 20:35 (used by the root user). If the restart is set by the shutdown command, you can use the shutdown -c command to cancel the restart.

Linux centos shutdown command:

1, halt Shut down immediately 2, poweroff shut down immediately 3, shutdown -h now Shut down immediately (used by the root user) 4, shutdown -h 10 10 minutes after the automatic shutdown If you set the shutdown through the shutdown command, you can use the shutdown -c command to cancel the restart

1.shutdown

The shutdown command safely shuts down the system. Some users will shut down Linux by directly disconnecting the power supply, which is very dangerous. Because linux and windows are different, there are many processes running in the background, so forcible shutdown may result in data loss of the process, making the system unstable, 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 users that the system will be shut down. And the login command will be frozen, ie the new user can no longer log in. It is possible to shut down directly or delay the system for a certain period of time, and it may be restarted. This is determined by all the processes that receive the signal from the system. This allows programs like vi to have time to store documents that are currently being edited, while programs like mail and news can leave normally. 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], runlevel 6 is used to reactivate the [reboot] system, and runlevel 1 is used to get the system into a state where management can be performed; this is preset, assuming no -h There is also no -r parameter for shutdown. To find out what actions have been taken during a halt or reboot, 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 turning off the power. [-n] Instead of init, shut yourself down. This option is discouraged and the consequences of this option are often not always what you expect. [-c] cancel current process Cancel the shutdown program currently being executed. So of course this option has no time parameters, 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, the application process is killed, the sync system call is executed, and the kernel system stops when the file system write operation is completed. Parameter Description: [-n] Prevents the sync system call. It is used to fix the root partition with fsck to prevent the kernel from overwriting the repaired super block with the old version of the 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. 3. The working process of rebootreboot is almost the same as that of halt, but it causes the host to restart, and the halt is shutdown. Its parameters are similar to those of halt.

4.initinit 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 and so on. Shutdown is to use this mechanism. Init defines 8 runlevels, init 0 is shutdown, and init 1 is restart. About init can be a long story, and will not be described here. In addition, the telinit command can change the running level of init. For example, telinit -iS can make the system enter single-user mode, and can not get the information and waiting time when using shutdown.

Freedom blog blog to share these, will later add the installation and use of the lamp tutorial, of course, starting from Linux

Copyright © Windows knowledge All Rights Reserved