Short command
Shutdown,poweroff,reboot,halt,init are capable of shutting down, roughly using the method.
/sbin/halt [-N] [-W] [-d] [-f] [-i] [-p] [-h]
/sbin/reboot [-N] [-W] [-d] [-f] [-I.]
/sbin/poweroff [-N] [-W] [-d] [-f] [-i] [-h]
[email protected] ~]$ reboot--h
Usage:reboot [-N] [-W] [-d] [-f] [-h] [-I.]
-N: not synchronized before stopping the system
-W: Just write wtmp reboot record and leave
-D: Do not write Wtmp records
-F: Forced shutdown or restart
-H: Leave the hard drive in stand-alone mode
-I: Turn off all network interfaces
Shutdown process
1. Flush the hard disk cache:
2. Log restart Event: (/var/run/utmp,/var/log/wtmp)
3. Kill All Processes:
4. Finally restart the machine:
shutdown example
# shutdown-h Now #立马关机
# shutdown-h ' Halt ' #2点30分关机, pay attention to the time of the machine
# halt-p #立马关机
# init 0 #马上将系统执行级别切换为0, i.e. shutdown
# Shutdown now #切换至单人操作模式 (no matter what option)
Reboot sample
# shutdown-k Now ' reboot ' #发出警告讯息, but without really shutting down the machine.
# shutdown-t5-r now #立马重新启动, but between the warning and delete processes, the delay is 5 seconds.
# init 6 #马上将系统执行级别切换为6, restart
# shutdown-r +10 ' reboot ' #10分钟后重新启动
# shutdown-c #取消之前的shutdown命令
# Shutdown-r Now #立马重新启动
Shutdown preparation
Linux is no more than windows, assuming it doesn't shut down properly. Failure to write data back to the file may result in file system corruption. So before shutting down, pay attention to:
1. Observing the System status
- View online users with the WHO command
- View Network online status with the Netstat-a command
- Use PS aux command to view background running program
2. Notify online users #shutdown-k now ' System would reboot in minutes! '
3. Use the correct command #首先要搞清楚是关机还是重新启动, followed by the number of references
4. Note The data synchronization #使用sync数据同步写入磁盘
Other instructions
1. Review the restart record
# last Reboot
2. Remote Boot machine
# SSH [email protected]/sbin/reboot
# SSH [email protected]/sbin/shutdown-r now
Copyright notice: This article Bo Master original article. Blog, not reproduced without consent.
Linux switch command (shutdown,reboot,halt,init)