Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The correct method of shutdown under CentOS

2025-01-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "the correct method of shutdown under CentOS". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1 prepare before shutting down

1.1 observe the usage status of the system

Who is online: who

Networking status: netstat-a

Program executed in the background: ps-aux

1.2 notify online users of shutdown time

Shut down the computer after shutdown + 2 "The machine will shutdown" # 2min and notify the online user.

2 shutdown command

2.1 sync

Write data that is not written to the hard disk in memory to the hard disk

2.2 shutdown

Shutdown now # shut down immediately

Shutdown after shutdown + 2 # 2 min

Shutdown 10:01 # 10:01 shutdown

Shut down the computer after shutdown + 2 "The machine will shutdown" # 2min and notify the online user.

2.3 reboot

Restart. After adding parameters, halt,poweroff can be realized.

2.4 halt

A link to reboot, equivalent to shutdown-h

2.5 poweroff

A link to reboot, the equivalent of halt

3 execution level

3.1 Grade division

Run level 0: shutdown

Run level 3: plain text mode

Run level 5: including graphical interface mode

Run level 6: restart

3.2 level switching

Init 0 # switches to level 0, that is, shutdown

Attached: shutdown,halt,poweroff distinction

Shutdown: to shut down the system, refer to the existing explanation: "the command shuts down the system safely." Some users will turn off the linux by directly disconnecting the power supply, which is very dangerous. Because linux is different from windows, there are many processes running in the background, so forced shutdown may lead to data loss of processes, make the system in an unstable state, and even damage hardware devices in some systems. Using the shutdown command before the system shuts down, the system administrator will inform all logged-in users that the system is going to shut down. And the login instruction is frozen, meaning that new users can no longer log in. It is possible to shut down the phone directly or delay it for a certain amount of time, and it is also possible to restart it. This is determined by the fact that all processes (process) receive a signal (signal) delivered by the system. This gives programs like vi time to store documents that are currently being edited, while programs like mail and news can leave normally and so on. "

And shutdown will execute the script under / etc/rc0.d/, that is, the script for runlevel 0. Halt will not.

Poweroff: power off the system

Poweroff is just a soft link for halt. The halt command is also executed. With regard to the halt command, it can be understood that halt is a call to shutdown-h. When halt executes, it kills the application process, executes the sync system call, and stops the kernel after the file system write operation is complete.

This is the end of the content of "the correct method of shutdown under CentOS". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 219

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report