Linux System has 7 runlevel (runlevel)
Run Level0: System shutdown status, the system default operation level cannot be set to 0, otherwise it will not start normally
Run Level 1: Single User working status, root privilege, for system maintenance, prohibit remote login
Run Level 2: Multi-user status (no NFS)
Run Level 3: Full multi-user status (with NFS), login to console command line mode
Run Level 4: System not used, reserved
Run Level 5:x11 Console, enter GUI mode after login
Run Level 6: The system shuts down gracefully and restarts, the default runlevel cannot be set to 6, otherwise it will not start normally
Last-x
RunLevel (to lvl 3) 2.6.32-573.12.1. Sun APR 9 17:34-00:22 (1+06:48)
Reboot Systemboot 2.6.32-573.12.1. Sun APR 9 17:34-00:22 (1+06:48)
Shutdown system down 2.6.32-573.12.1. Sun APR 9 17:30-17:34 (00:03)
RunLevel (to lvl 6) 2.6.32-573.12.1. Sun APR 9 17:30-17:30 (00:00)
RunLevel (to lvl 3) 2.6.32-573.12.1. Sun APR 9 17:18-17:30 (00:12)
Reboot Systemboot 2.6.32-573.12.1. Sun APR 9 17:18-17:30 (00:12)
Shutdown system down 2.6.32-573.12.1. Sun APR 9 17:15-17:18 (00:03)
RunLevel (to lvl 6) 2.6.32-573.12.1. Sun APR 9 17:14-17:15 (00:00)
RunLevel (to lvl 3) 2.6.32-573.12.1. Tue APR 4 14:07-00:22 (6+10:15)
Reboot Systemboot 2.6.32-573.12.1. Tue APR 4 14:07-00:22 (6+10:15)
Shutdown system down 2.6.32-573.12.1. Tue APR 4 14:03-14:07 (00:03)
RunLevel (to lvl 6) 2.6.32-573.12.1. Tue APR 4 14:03-14:03 (00:00)
In CentOS 6, graceful shutdown has a process from 6 to down to boot to 3.
You should see alternating runlevels 3 with either 0 or 6,such as
3->6->3->6->0->3->6. It doesn ' t has to be runlevel 3. For CM andmessaging,
It ' s RunLevel 4. Check/etc/inittab to see the default. however.
It alternate default runlevels with 0 ' or 6 ' s Where0=shutdown and 6=reboot,
This isgraceful. If you see 2 3 ' s in a row, Itwas ungraceful.
Ex:runlevel (to lvl 3) 2.6.18-164.15.1. Thu Feb 10 10:31-08:11 (400+20:39)
Ex:reboot system Boot 2.6.18-164.15.1. Thu Feb 10 10:31 (400+20:39)
Ex:shutdown systemdown 2.6.18-128.7.1.e Thu Feb 10 10:27-08:11 (400+20:43)
Ex:runlevel (to Lvl6) 2.6.18-128.7.1.e Thu Feb 10 10:27-10:27 (00:00)
If you see the something like this where you go from runlevel 3to a system boot,
Then you had anungraceful shutdown (3->3).
Ex:runlevel (to Lvl3) 2.6.18-164.15.1. Thu Feb 10 10:31-08:11 (400+20:39)
Ex:reboot system Boot 2.6.18-164.15.1. Thu Feb 10 10:31 (400+20:39)
Ex:runlevel (to Lvl3) 2.6.18-128.7.1.e Thu Feb 10:27-crash (00:00)
If it is from 3 to 3 means that, when the shutdown, the system has not yet time to identify the 6, it has been powered off, is ungraceful shutdown.
[Email protected] ~]# last-x
Root pts/0 192.168.17.1 Tue Apr 14:57 still Loggedin
RunLevel (to lvl 5) 2.6.32-642.el6.x Tue Apr 1114:57-14:58 (00:00)
Reboot system boot 2.6.32-642.el6.x tueapr 11 14:57-14:58 (00:00)
Lyp pts/0 192.168.17.1 Tue Apr 14:53-crash (00:03)
RunLevel (to lvl 5) 2.6.32-642.el6.x Tue Apr 1114:52-14:57 (00:04)
Reboot system boot 2.6.32-642.el6.x tueapr 11 14:52-14:58 (00:05)
Shutdown system down 2.6.32-642.el6.x Tue APR 11 14:52-14:52 (00:00)
RunLevel (to lvl 0) 2.6.32-642.el6.x Tue Apr 1114:52-14:52 (00:00)
Linux ungraceful shutdown