Section: Maintenance Commands (8)
Return to Main Contents
runlevel - output previous and current runlevel
reads the system
file, which defaults to
when no alternate filename is given, to locate the most recent runlevel
The previous and current runlevel from that record are output separated
by a single space. If there is no previous runlevel in the record, the letter
will be substituted.
If no runlevel record can be found,
outputs the word
and exits with an error.
During system boot, the environment variables
will be set by the
daemon, these come from the
event generated by
When these environment variables are set,
will output the values from these instead. Thus
can be used in
scripts as a replacement for the System-V
Does not output the current and previous runlevel, nor does it output
in the case of error (but it will exit with an error code).
This may be used to test for the presence of a runlevel entry, or to check
for errors reading from the file.
will exit with status
record was found, otherwise it will exit with status
will read the current runlevel from this environment variable if set in
preference to reading from
will read the previous runlevel from this environment variable if
was given, in preference to reading from
Where the current and previous runlevels will be read from.
daemon does not keep track of runlevels itself, instead they are implemented
entirely by its userspace tools.
A change of runlevel is signalled by the
event, generated by either the
tools. This event includes the new runlevel in the
environment variable, as well as the previous runlevel (obtained from
their own environment or from
As well as generating the event, both tools write the new
runlevel back to
and append a new entry to
Written by Scott James Remnant
Report bugs at
Copyright © 2009 Canonical Ltd.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- EXIT STATUS
- REPORTING BUGS
- SEE ALSO
This document was created by
using the manual pages.
Time: 03:11:41 GMT, January 24, 2018