This post will show you the proper command to shutdown and reboot the linux server. To shut down Red Hat Enterprise Linux(RHEL) and CentOS, the root user may issue the /sbin/shutdown command. All the command has been tested on CentOS 6.2 but may workings on other CentOS and RHEL version. The shutdown man page has a complete list of options, but the two most common uses are:
Example 1. How to Properly Shutdown CentOS 5/CentOS 6/RHEL 5/RHEL 6 :
[root@centos62 ~]# /sbin/shutdown -h now
Example 2. How to Properly Reboot CentOS 5/CentOS 6/RHEL 5/RHEL 6 :
[root@centos62 ~]# /sbin/shutdown -r now
After shutting everything down, the -h option halts the machine, and the -r option reboots.
These are another useful shutdown command :
Example 3. To shutdown in next 10 minutes:
[root@centos62 ~]# /sbin/shutdown -h +10
Example 4. To reboot in next 10 minutes:
[root@centos62 ~]# /sbin/shutdown -r +10
Example 5. To shutdown the server in next 3 seconds :
[root@centos62 ~]# /sbin/shutdown -t3 -r now
The option “-t3” tells the shutdown command to wait 3 seconds before it starts killing processes.
Example 6. Resheduled to shutdown the server at 12:15 :
login as: root root@192.168.1.44's password: Last login: Fri Jun 1 12:05:27 2012 from 192.168.1.52 [root@centos62 ~]# date Fri Jun 1 12:12:00 MYT 2012 [root@centos62 ~]# /sbin/shutdown -r 12:15 Broadcast message from root@centos62.ehowstuff.local (/dev/pts/0) at 12:12 ... The system is going down for reboot in 3 minutes! Broadcast message from root@centos62.ehowstuff.local (/dev/pts/0) at 12:13 ... The system is going down for reboot in 2 minutes! Broadcast message from root@centos62.ehowstuff.local (/dev/pts/0) at 12:14 ... The system is going down for reboot in 1 minute!