When performing Linux system operation, if there is a situation such as hardware replacement, system configuration change and crash, you need to restart the computer, and restart the system in different situations. The difference is also that the commands used are different. The following small series will introduce you to the restart method of different situations under Linux.
different from the desktop, as a server, we have less of a Linux system to restart the system, but in the following situations arise, we will restart the machine:
replacing hardware < Br>
Change system configuration
System is dead, need to restart recovery
Shut down and restart system mode
Booting system can only use one method in essence, The difference is that there are several ways to shut down or reboot the system:
Power off (power off)
Use the shutdown command
Use the halt, poweroff or reboot command
>
Using telinit to change the init runlevel
Turning off the power
It is not a good habit to power off the machine directly for two reasons:
May cause hardware damage
Some data may still be in memory and not written back to disk. At this time, power loss may result in data loss or file system damage;
Therefore, try to use other methods to shut down or reboot. system.
shutdown command
Use shutdown to suspend or reboot the system, use the -h option to suspend the system, and use the same function as the halt command; use -r The option indicates to reboot the system and has the same effect as the reboot command.
After executing the shutdown command, the system will send a suspend or restart message to all login users.
Sending a suspend 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
Sending a restart message after executing shutdown –r now:
Code 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 system to hang Or the time and description of the restart, the following two cases:
1:00 in the morning to stop maintenance:
The code is as follows:
[sql]
shutdown –h 1:00 “going down for scheduled maintenance. Expected downtime is 1 hour.”
Specify the shutdown time after 15 minutes of shutdown:
The code is as follows:
[sql] shutdown –h +15 <quo;going down for emergency check.”
halt and reboot commands
halt records shutdown, terminates unnecessary processes, executes sync system Call, wait for the file system write operation to complete, then stop the kernel, the poweroff command is equivalent to halt.
From the above <;shutdown –h” and “shutdown –r” execution output, you can execute halt Enter run level 0 I.e., the reboot run level 6, the log file /var /log /messages logged in the appropriate log.
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]
System hangs 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 record, you can determine whether the machine is restarting unintentionally or manually.
telinit Command
Executing the telinit command can direct init to the specified run level, such as rebooting the system:
The code is as follows:
[sql]
#telinit 6
When using telinit, you won't get a friendly warning message like running shutdown, less of a suspend and restart command, but a server that modifies the /etc/inittab file. Restarting the system is a relatively large move. When an operating system related failure occurs, we should first consider collecting log information and then restarting the system if necessary.
The above is the introduction of different restart methods for different situations under Linux. There are many kinds of restart commands. You need to apply the most appropriate commands to restart the machine to prevent machine errors.
When you are working on a Linux system, the mount hard disk appears mount:Structure needs cleaning e
after Ubuntu Qt is transplanted to the development board Qt is an object-oriented framework. It can
There is no rc.local in SUSE Linux 10, you want to use it you have to write an rc script file in the
In order to more convenient Internet access, we usually let our computer bind the network card. Howe
Linux iis can not run asp file how to solve
How to use the history command in Linux
Linux Ubuntu tab key auto-completion command method
Linux system file permissions and access mode introduction
How to configure yum source in CentOS system
Linux uses the blockdev command to adjust the file read-ahead size
What should I do if a Linux normal user does not have permission to use the command?
How to view the version of MariaDB server on Linux system
How to use the showmount command in Linux systems
How does Ubuntu recover the GNOME Panel that was accidentally deleted?
What if the CentOS 5.5 system does not recognize the Atheros AR8151 NIC?
A simple way to implement FTP virtual host under Linux system
Hide Win8 Desktop Recycle Bin Tips
Win10 forced automatic update KB3074681 caused the resource manager to crash
How does Win7 display the quick launch bar?
Win10 start menu: Win7 users will like
If Win Vista is under the chaos, what should I do?
Win7 shutdown automatically clears the folder
Win10 11103 English version installation Chinese language package tutorial
How to use the gesture password of NetEase mailbox
LOL October 30 cloning battle ended LOL clone mode offline announcement