Shutdown (reboot)

Source: Internet
Author: User
Tags ssh server

Shutdown

Since Linux's host is so important, except when you log on to the system with a tty7 interface in front of the host, regardless of what identity can be used to access the host, if you are using a terminal management tool (such as logging on to the host using the SSH server through pietty ), then, the server only has root privileges!

Well! Now, let's go and check out our host! We usually use the shutdown command, which notifies the system of various processes ), and some services in the run-level system will be notified. Shutdown can be implemented as follows:

  • The user can choose the mode of turning on the host freely: either to shut down the host, start the host again, or enter the ticket operation mode;
  • Ability to set the shutdown time: the ability to set the current instant shutdown, but also the ability to set a specific time to shut down the machine.
  • Ability to disable the host information: Before the host is disabled, the user can send the preset host information to the host.
  • Warning Message: Sometimes you may want to perform some tests instead of asking other users to perform the tests, or explicitly tell the user to pay attention for a certain period of time! At this time, shutdown can be used to shut down a single user, but it is not really necessary to shut down the machine!
  • You can choose whether to use the fsck to check the ICP filing system.

So what is the shutdown mechanism? Xiaoming's creator is probably already looking for "man! No thanks. It's a pretty good man at random! All right, the legal provisions of the statement are as follows:

[[Email protected] ~] #/Sbin/shutdown [-T seconds] [-arkhncff] time [warning message] Options and parameters:-T sec:-T plus the number of seconds after the end, that is to say, "Shut down after several seconds" means-K: don't really shut down, just send a warning message! -R: After the system service is stopped, start again (frequently used)-H: After the system service is stopped, shut down immediately. (Frequently used)-N: without passing through the INIT program, directly shut down the machine with the shutdown function-F: after the machine is shut down and the machine is turned on, disk Quota for fsck generation-F: After the system is turned on again, the disk quota for fsck generation is checked-C: cancels the existing shutdown instruction content. Time: this is the number of parameters that must be added! Specify the time for the system to shut down! The example of time will be explained below. Example: [[email protected] ~] #/Sbin/shutdown-H 10' I will shutdown after 10 mins' # tell everyone that this machine will shut down after being very busy! And will appear in front of the login screen! # So what are the parameters? Here are some examples!

In addition, note that the time parameter data must be added to the instruction, otherwise, shutdown will automatically jump to run-Level 1 (that is, the login status of a single-person login), so it will be difficult! Below is an example of several time parameters:

[[Email protected] ~] # Shutdown-H now: immediately shut down the machine. In this case, the "now" parameter is equivalent to the parameter value of 0 [email protected] ~]. # The shutdown-H 20:25 system will shut down at today. If this command is executed only at, it will take several days to shut down [[email protected] ~] # Shutdown-H + 10 system: automatically shut down the host after a very long time [email protected] ~] # Shutdown-R now: the system immediately started again [[email protected] ~] # Shutdown-R + 30 'the system will reboot' after 30 minutes, the system will start again, and show the following response to all users on the listener [[email protected] ~] # Shutdown-k now 'this system will reboot' refers to the number of parameters that sent a warning letter! The system will not be shut down! Released!
Start again, shut down: reboot, halt, poweroff

There are three other commands that can be used to re-enable and disable the host, namely reboot, halt, and poweroff. In fact, the call methods for these three commands are almost the same. So when you use "Man reboot", you can see how to use the three commands at the same time. Actually, the hacker usually only has two commands, shutdown and reboot! However, using the poweroff command is a simple command! Usually, when the primary brother powers up again, he will run the following commands:

[[email protected] ~]# sync; sync; sync; reboot

Since these commands can be shut down or re-opened, is there any problem with him? Basically, all these commands have completed the same job in the case of an attacker! (Because halt will call shutdown first, and shutdown will call halt later !). However, shutdown can be used to shut down the servers based on the currently active servers; as a result, halt enables users to perform special hard-host shutdown functions in the current system environment! You can run the following two commands on your host to shut down the host. Let's see where the problem is!

[[email protected] ~]# shutdown -h now[[email protected] ~]# poweroff -f

Many other selection functions of halt and poweroff must be checked by man!

 

 

Split the worker line and other worker: init

In this chapter, we have been dealing with run level issues. Previously, the running mode of the system was defined as run level 3 and run level 5 ). Is there any other mode except these two modes? In fact, Linux has seven types of parallel threads, and seven types of parallel threads mean that we will try again later. In this chapter, you only need to know the following four types of reserved rows:

  • Run level 0: Shut down
  • Run level 3: plain text mode
  • Run level 5: contains the hierarchical interface mode
  • Run level 6: start again

So how to switch between different models? Can use the init command to handle it! That is to say, if you want to shut down the host, you can also use the following commands in addition to the shutdown-H now and poweroff commands:

[[email protected] ~]# init 0

Http://linux.vbird.org/

 

Shutdown (reboot)

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.