Linux reboot command details

Source: Internet
Author: User
In Linux, some common shutdown/restart Commands include shutdown, halt, reboot, and init,
Both of them can achieve the purpose of restarting the system, but the internal working process of each command is different.
In this article, we hope you can use various shutdown commands more flexibly.

 

1. Shutdown
The shutdown command safely shuts down the system. Some users may directly disconnect the power supply.
It is very dangerous to disable Linux. Because Linux and Windows are different, the background runs a lot
So forced shutdown may lead to data loss in the process, making the system unstable.
In some systems, hardware is damaged.
When the shutdown command is used before the system is shut down, the system administrator notifies all logged-on users
The system will be closed. The LOGIN command is frozen, meaning that new users cannot log on again. Direct shutdown or
It is possible to shut down after a certain delay and restart. This is caused by all processes (process 〕
It is determined by the signal [Signal] delivered by the system. This gives programs like Vi time storage.
Save the documents that are being edited, and programs like mail and news can
Leave normally.
Shutdown is to send a signal [Signal] To the INIT program and ask it to change
Runlevel. Runlevel 0 is used to stop [halt] And runlevel 6 is used to reactivate
[Reboot] system, while runlevel 1 is used to let the system enter the management work.
This parameter is preset. If there is no-H and no-R parameter, shutdown is provided. To learn about downtime
In this article
The runlevels-related information is displayed in the/etc/inittab.

Shutdown parameter description:
[-T] before changing to another runlevel, tell init how long it will take to shut down.
[-R] restart the calculator.
[-K] does not actually shut down, but sends a warning signal to each consumer [login 〕.
[-H] power off after Shutdown [halt 〕.
[-N] shut down by yourself instead of init. This option is not encouraged, and
The consequences are not always what you expected.
[-C] cancel current process cancels the currently running Shutdown program. So this
The option certainly does not have a time parameter, but you can enter a message for explanation, and this information will be sent
To each user.
[-F] Ignore fsck when restarting calculator [reboot.
[-F] forces The fsck when restarting the calculator [reboot.
[-Time] set the time before shutdown.

2. halt ---- the simplest shutdown command
In fact, halt calls shutdown-h. When halt is executed, the application process is killed and sync is executed.
After a system call is completed, the kernel is stopped.

Parameter description:
[-N] prevents sync system calls. It is used after the root partition is repaired with fsck to prevent kernel use
The old version of superblock overwrites the repaired superblock.
[-W] is not a real restart or shutdown, but a record for wtmp (/var/log/wtmp.
[-D] Do not write the wtmp record [included in Option [-n 〕.
[-F] Force shutdown or restart without calling shutdown.
[-I] disable all network interfaces before shutting down (or restarting.
[-P] this option is the default option. It is called poweroff when shutdown.

3. reboot
The reboot process is similar to that of halt, but it causes host restart, while halt is
Shut down. Its parameters are similar to those of halt.

4. init
Init is the ancestor of all processes, and its Process number is always 1, so send the TERM signal to init
All user processes and daemon processes are terminated. Shutdown uses this mechanism. Set init
The value of init 0 indicates that the system is shut down and init 1 indicates that the system is restarted. About init, you can
I will not describe it here. In addition, the telinit command can change the init running level.
For example, telinit-iS can enable the system to enter the single-user mode and disable shutdown.
.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.