Differences between shutdownhaltrebootinit and CentOS shutdown commands

Source: Internet
Author: User
In linux, some common shutdown/restart commands include shutdown, halt, reboot, and init, which can be used to restart the system. However, the internal working process of each command is different, through the introduction in this article, we hope you can use various shutdown commands more flexibly. 1. the shutdownshutdown command safely shuts down the system. It is very dangerous for some users to disable linux by directly disconnecting the power supply. Because linux and Windows

Some common shutdown/restart commands in linux include shutdown, halt, reboot, and init.
The system can be restarted, but the internal working process of each command is different.
We hope you can use various shutdown commands more flexibly.
1. shutdown
The shutdown command safely shuts down the system. Some users disable linux by directly disconnecting the power supply,
This is very dangerous. Different from windows, linux runs many processes in the background, so force shutdown May
Will the process data be lost? Make the system unstable? In some systems, hardware is damaged.
And use the shutdown command before the system is shut down? The system administrator notifies all logged-on users that the system will be disabled.
And the login command will be frozen? That is, new users cannot log on again. Shutdown directly or with a certain delay
Are they all possible? It may also restart. This is the signal that all processes will receive from the system [signal 〕
. Does this allow programs like vi to have time to store the files currently being edited? For example
News programs can leave normally.
Shutdown is to send a signal [signal] to the init Program? It is required to change the runlevel.
Runlevel 0 is used to stop [halt 〕? Is runlevel 6 used to reactivate the [reboot] system?
Runlevel 1 is used to bring the system into a state where management work can be performed? Is this preset? If there is no-h
No-r parameter is provided to shutdown. If you want to know what has been done during the shutdown (halt) or re-boot (reboot) process
Action? You can view the runlevels related information in the/etc/inittab file.
Shutdown parameter description:
[-T] before changing to another runlevel? Tell init how long it will take to shut down.
[-R] restart the calculator.
[-K] isn't it true to shut down? Only a warning signal is sent to each login 〕.
[-H] power off after shutdown [halt 〕.
[-N] no init? Instead, shut down the server by yourself. Are you not encouraged to use this option? And the consequence of this option is always
Never always what you expected.
[-C] cancel current process cancels the currently running shutdown program. So of course this option does not exist.
Time parameter? But can I enter a message for explanation? 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? Killing an application process? Execute sync system call?
After the file system writes, the kernel is stopped.
Parameter description:
[-N] how to prevent sync system calls? After fsck is used to fix the root partition? To prevent the kernel from using an earlier version
The level block (superblock) overwrites the repaired super block.
[-W] isn't it a real restart or shutdown? Write the wtmp (/var/log/wtmp) record.
[-D] do not write the wtmp record [included in option [-n 〕.
[-F] force shutdown or restart without calling shutdown.
Before [-I] shutdown [or restart? Disable all network interfaces.
[-P] This option is the default option. It is called poweroff when shutdown.

3. reboot
Is reboot working like halt? But does it cause host restart? While halt is shut down. It
The parameters are similar to those of halt.
4. init
Is init the ancestor of all processes? Its process number is always 1? Therefore, sending a TERM signal to init will terminate all
User process? Daemon. Shutdown uses this mechanism. Init defines eight runlevels ),
Is init 0 shutdown? Init 1 indicates restart. Can init be a long story? This is not described here. In addition
Can the telinit command change the running level of init? For example? Does telinit-iS enable the system to enter single-user mode?
The shutdown information and waiting time are not available.


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.