Linux centos Shutdown and restart command __linux

Source: Internet
Author: User

Linux centos Shutdown and restart command detailed and practical

Linux CentOS Reboot command: 1, reboot 2, Shutdown-r now reboot (root user) 3, shutdown-r 10 10 minutes automatic restart (root user) 4, shutdown-r 20: 35 reboot at 20:35 time (root user use)

If you set the reboot through the shutdown command, you can cancel the reboot with the SHUTDOWN-C command

Linux centos Shutdown command: 1, halt immediately shut down 2, Poweroff immediately shut down the Machine 3, Shutdown-h now immediately shut down (root user) 4, shutdown-h 10 10 minutes after automatic shutdown

If you are setting the shutdown via the shutdown command, you can cancel the reboot with the SHUTDOWN-C command

1.shutdown

The shutdown command shuts down the system securely. Some users will turn off Linux by using a direct power cut.

This is very dangerous. Because Linux differs from windows in that it runs many processes in the background, forcing a shutdown may

Can cause data loss in the process, leaving the system in an unstable state, or even damaging hardware devices in some systems.

Using the shutdown command before the system shuts down, the system administrator notifies all logged-in users that the system will be closed.

And the login command is frozen, that is, the new user can no longer log in. Turn off the machine directly or delay it for a certain time

Are possible and may also be restarted. This is the signal that all process (process) will receive the system service (signal)

decided. This lets programs like VI have time to store documents that are currently being edited, rather like processing mail (mail) and

The News (news) program can leave normally and so on.

Shutdown performs its work by sending signals (signal) to the INIT program, requiring it to change runlevel.

RunLevel 0 is used to stop (halt),runlevel 6 is used to reactivate the (reboot) system,

And RunLevel 1 is used to allow the system to enter the state of management can be done; this is preset, assuming that no-H is

No-r parameter to shutdown. To find out what you did during an outage (halt) or a reboot (reboot)

Action, you can see these runlevels related information in this file/etc/inittab.

Shutdown parameter Description:

[-T] tell Init how long to shut down before changing to another runlevel.

[-R] to 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 the computer.

[-n] do not need to init, but to shut down the machine. Use of this option is discouraged, and the consequences of this option are

It's not always what you expect.

[-c] Cancel current process cancels the currently executing shutdown program. So this option, of course, is not

Time parameter, but you can enter a message to interpret, and this information will be sent to each user.

[-f] ignores fsck while restarting Calculator (reboot).

[-f] Forces fsck when the calculator (reboot) is restarted.

[-time] Sets the time before the shutdown (shutdown).

2.halt--the simplest shutdown command

In fact, halt is called shutdown-h. Halt executes, kills the application process, performs the sync system call,

The kernel is stopped when the file system write operation is complete.

Parameter description:

[-n] Prevents sync system calls, which are used after patching the root partition with fsck to prevent the kernel from using the old version of the super

Block (superblock) overwrite the patched super block.

[-W] is not a real reboot or shutdown, just write Wtmp(/var/log/wtmp) records.

[-d] does not write Wtmp records (already included in options [-n]).

[-f] forced shutdown or reboot without invoking shutdown.

[-i] turn off all network interfaces before shutting down (or rebooting).

[-p] This option is the default option. is to call Poweroff when shutdown.

3.reboot

Reboot's work process is almost the same as halt, but it triggers a host reboot, and Halt is shutdown. It

The parameters are not much different from the halt.

4.init

Init is the ancestor of all processes, and its process number is always 1, so sending term signals to INIT will terminate all

User process ﹑ daemon and so on. Shutdown is the use of this mechanism. Init defines 8 run levels (RunLevel),

Init 0 is shutdown,init 1 for reboot. There is no longer a narrative about init that can be lengthy. In addition, there are

The Telinit command can change the running level of init, such as,telinit-is, which allows the system to enter Single-user mode.

And you don't get the information and wait time to use shutdown.

How Linux modifies the root admin password

Log in as root (SSH operation)

Enter the passwd command to see the prompt to enter a new password

Related Article

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.