What is the linux server restart command?

青灯夜游
Release: 2022-03-15 11:05:31
forward
184086 people have browsed it

Commonly used shutdown/restart commands in Linux include shutdown, reboot, init, halt and poweroff. They can all achieve the purpose of restarting the system, but the internal working process of each command is different. The following article will introduce these commands to you. I hope it will be helpful to you. [Video tutorial recommendation:linux tutorial]

What is the linux server restart command?

1. shutdown command

shutdown command is the most commonly used It is also the safest shutdown and restart command. It will call fsck to check the disk before shutting down. -h and -r are the most commonly used parameters:

● -h: Stop the system service and shut down

● -r: Stop the system service and then restart it

Example:

shutdown -h now --立即关机 shutdown -h 10:53 --到10:53关机,如果该时间小于当前时间,则到隔天 shutdown -h +10 --10分钟后自动关机 shutdown -r now --立即重启 shutdown -r +30 'The System Will Reboot in 30 Mins' --30分钟后重启并并发送通知给其它在线用户
Copy after login

2. Reboot command

reboot means restart immediately, the effect is equivalent toshutdown -r now.

3. init command

init is the ancestor of all processes. Its process number is always 1, so sending the TERM signal to init will terminate all user processes. daemon process etc. shutdown uses this mechanism.

init defines 7 runlevels:

  • init 0means shutdown or shutdown (never set initdefault to 0 ),

  • init 1is single-user mode, and only the root user performs maintenance.

  • init 2- Multi-user, no NFS, no network

  • init 3- Complete Multi-user mode (standard run level)

  • ##init 4- not used

  • init 5- X11 (xwindow) graphical interface mode

  • init 6- Restart (do not set initdefault to 6)

4. Halt command

The halt command is the simplest shutdown command, which is actually calling

shutdown -h. When halt is executed, it ignores the current system status and performs a hardware shutdown; kills the application process, executes the sync system call, and stops the kernel after the file system write operation is completed.

5. Poweroff command

poweroff means immediate shutdown, the effect is equivalent to

shutdown -h now, in multi-user mode (Run Level 3 )Not recommended for use.

The above is the entire content of this article, I hope it will be helpful to everyone's study. For more exciting content, you can pay attention to the relevant tutorial columns of the PHP Chinese website! ! !

The above is the detailed content of What is the linux server restart command?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:linuxbaike
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!