In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to configure Linux system to restart when hardware replacement, system configuration change, panic and so on". In daily operation, it is believed that many people have doubts about how to configure Linux system when hardware replacement, system configuration change, crash and other situations occur. The editor consulted all kinds of materials and sorted out simple and useful methods of operation. I hope it will be helpful for you to answer the question of "how to configure the Linux system to change hardware, change system configuration, crash and other situations when the machine restarts"! Next, please follow the editor to study!
Unlike desktop systems, as servers, we rarely restart the Linux system, but we restart the machine when the following situations occur:
Replace hardware
Change system configuration
The system is dead and needs to be rebooted and restored.
Shut down and restart the system
Unlike the essence of booting the system in one way, there are several ways to shut down or reboot the system:
Turn off the power (power down)
Use the shutdown command
Use the halt, poweroff, or reboot command
Use telinit to change the init run level
switch it off
It is not a good habit to power the machine directly for two reasons:
May cause hardware damage
Some of the data may still be in memory and have not been written back to disk, so the power off will lose the data or cause file system damage.
Therefore, try to use other ways to shut down or reboot the system.
Shutdown command
Use shutdown to suspend (halt) or restart (reboot) the system, use the-h option to indicate that the system is suspended, which has the same effect as the halt command, and use the-r option to indicate that the system is rebooted, which has the same effect as the reboot command.
After executing the shutdown command, the system sends a suspend or restart message to all logged-in users.
Send a pending message after executing shutdown-h now:
The code is as follows:
[sql]
# shutdown-h now]
Broadcast message from root (tty1) (Thu May 3 10:58:22 2012):
The system is going down for system halt NOW!
INIT: Switching to runlevel: 0
INIT: Sending processes the TERM signal
Send a restart message after executing shutdown-r now:
The code is as follows:
[sql]
# shutdown-r now
Broadcast message from root (tty1) (Thu May 3 11:18:22 2012):
The system is going down for system reboot NOW!
INIT: Switching to runlevel: 6
INIT: Sending processes the TERM signal
After performing shutdown, other users can no longer log in to the system, and we can specify the time when the system is suspended or restarted, as well as instructions, as shown in the following two examples:
1: 00 am downtime maintenance:
The code is as follows:
[sql]
Shutdown-h 1:00 "going down for scheduled maintenance. Expected downtime is 1 hour."
Specify the relative shutdown time for 15 minutes and then shut down:
The code is as follows:
[sql] shutdown-h + 15 "going down for emergency check."
Halt and reboot commands
Halt records shutdown, terminates unnecessary processes, executes sync system calls, waits for file system writes to complete, and then stops the kernel. Poweroff command is equivalent to halt.
From the above "shutdown-h" and "shutdown-r" execution output, the execution of halt enters runlevel 0, the execution of reboot enters runlevel 6, and the corresponding log is recorded in the log file / var/log/messages.
System restart log:
The code is as follows:
[sql] May 3 11:45:25 slot14 shutdown [11119]: shutting down for system reboot
May 3 11:45:25 slot14 init: Switching to runlevel: 6
May 3 11:45:25 slot14 user_cmd: 2012-05-03 11:45:25 shutdown-r now by root from [root tty1 May 3 11:44]
The system suspends the log:
The code is as follows:
[sql] May 3 10:50:22 slot14 shutdown [11561]: shutting down for system halt
May 3 10:50:22 slot14 init: Switching to runlevel: 0
May 3 10:50:22 slot14 user_cmd: 2012-05-03 10:50:22 shutdown-h now by root from [root tty1 May 3 10:48]
By looking at the / var/log/messages log records, you can determine whether the machine is rebooted for no reason or artificially.
Telinit command
Execute the telinit command to direct init to the specified run level, such as restarting the system:
The code is as follows:
[sql]
# telinit 6
When you use telinit, you don't get as friendly warnings as you do with shutdown, and it's less likely to be used as a suspend and restart command, but it's a big action to restart the system by modifying the server for the / etc/inittab file. When operating system-related failures occur, we should first consider collecting log information, and then restart the system if necessary.
At this point, the study on "how to configure the Linux system to change hardware, change system configuration, crash and other situations when the machine restart" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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: 0
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.