Thanks to visit codestin.com Credit goes to man.x-cmd.com
runlevel [utmp]
Find the current and previous system runlevel
If no utmp file exists or if no runlevel record can be found, print "unknown"