Shutdown related (shutdown,reboot)

Source: Internet
Author: User

Use of the machine directive: shutdown

Because Linux is the most important thing to do, so in addition to being in front of the Tty7 to log in to the system, regardless of the identity you are able to use, if you are using remote management tools (such as through the pietty using SSH services from other computers), the aircraft Just Root has power.

Well! Then let's try it! We often use the shutdown directive, which notifies the system of the programs (processes) and closes some of the services in the run-level of the notification system to the user. Shutdown can achieve such tasks as the following:

    • Be able to freely select the mode of the machine: it is to the machine, another time to open the machine or into single operation mode can be;
    • The ability to set the time: to be able to set up a plane immediately, but also to set a specific time for the machine.
    • The ability to customize the message: Before the aircraft, you can set the message to the online user.
    • can only produce warning messages: Sometimes you might want to do some testing instead of bothering other users, or explicitly tell the user to pay attention to some time! This time you can use shutdown to scare users, but it's not really about the machine!
    • Be able to choose whether or not to fsck to check the file system.

So what is the shutdown language method? The smart reader has probably started looking for "man"! Yes, at random, the man is a very good move! Well, the simple language rules are:

/sbin/shutdown [-t sec] [-ARKHNCFF] time [warning message] Options and Parameters:-T sec:-T post plus seconds, which means "after a few seconds" meaning-K     : Do not really care, just send a warning message out! -R: After the     service of the system is stopped, it is again open (often used)-H     : After the system's service is stopped, the machine is immediately available. (often used)     -N: Not through the INIT program, directly to the shutdown function of the machine-F: After the machine and the machine, the force     of the disk after the fsck check-F: The system after another drive, the force     of the fsck disk check-C     : Take The shutdown directive that has been in the line. Time   : This is the parameter that must be added! Specify the time of the system! The time of the case will be stated below. Example:/sbin/shutdown-h ' I'll shutdown after ten mins '# Tell everyone that this machine will be in a very close-up! And will be displayed in front of the current login screen! # What are the parameters? Here's a few! 

In addition, it is important to note that the time parameter must be added to the instruction, or shutdown will automatically jump to Run-level 1 (which is a single-person login), so it hurts! Here are a few examples of the parameters:

 [[email protected] ~]# shutdown-h now   Instant, where now is 0 state  [[email protected] ~]# shutdown-h 20:25   [ [email protected] ~]# shutdown-h +10   system after a very few minutes of self-motion  [[email protected] ~]# shutdown-r now   The system flew again.  [[email protected] ~]# shutdown-r +30 ' the system would reboot '   after another 30 minutes, the system will start again and display the message to all the users on the line  [[email protected] ~]# shutdown-k now ' this system would reboot '  
Another time, machine: Reboot, halt, Poweroff

There are also three instructions that can be reboot, Halt, Poweroff, and the task of another machine. In fact, the three command calls are almost identical, so when you use "man reboot", there are three instructions to show you how to use them. The birds usually only remember the shutdown and reboot instructions! But it's easier to use the Poweroff command! ^_^ Usually the birds will come up with the following instructions for example:

Sync Sync Sync Reboot

Since these commands are capable of being connected to the machine or another time, what difference does he have? Basically, in the case of a preset, these instructions will all end up working like this! (because halt calls shutdown first, and shutdown finally calls halt! )。 But shutdown was able to shut down the services once and for all, according to the service that had now been initiated, so that halt was able to do the special functions of the hardware in a way that would not be the case in the present system! You can use root on your host machine to do the next two commands to the machine, compare the difference between the look where Oh!

Shutdown-h Now poweroff-f

Many other halt and poweroff options, please use man to find out!

Switch to perform rating: Init

In this chapter, we talked about the problem of run level. Previously, we talked about the system mode, which is divided into pure text (run Level 3) and graphics interface mode (Run Level 5). In addition to these two patterns, are there any other patterns? In fact, Linux has seven of the same class, seven-level meanings we'll talk about later. In this chapter, you just need to know the bottom four kinds of executive class:

    • Run Level 0: aircraft
    • Run Level 3: pure text mode
    • Run Level 5: Contains graphics interface mode
    • Run Level 6: Another time to start the machine

So how do you switch patterns? Be able to use the init command to deal with it! That is to say, if you want to have a machine, you can use the following instructions, in addition to the shutdown-h now and Poweroff, for example:

Init 0

Original: http://linux.vbird.org/

Shutdown related (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.