runlevel -- find the current and previous system runlevel.
SYNOPSIS
runlevel [utmp]
DESCRIPTION
Runlevel reads the system
utmp file (typically
/var/run/utmp) to locate the runlevel record, and then
prints the previous and current system runlevel on its standard output,
separated by a single space. If there is no previous system
runlevel, the letter N will be printed instead.
If no
utmp file exists, or if no runlevel record can be found,
runlevel prints the word unknown and exits with an error.
Runlevel can be used in rc scripts as a substitute for the System-V
who -r command.
However, in newer versions of init(8) this information
is also available in the environment variables RUNLEVEL and
PREVLEVEL.