runlevelSection: Maintenance Commands (8)
Index Return to Main Contents
NAMErunlevel - output previous and current runlevel
SYNOPSISrunlevel [OPTION]... [UTMP]
DESCRIPTIONrunlevel reads the system UTMP file, which defaults to /var/run/utmp when no alternate filename is given, to locate the most recent runlevel record.
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 N will be substituted.
If no runlevel record can be found, runlevel outputs the word unknown and exits with an error.
When these environment variables are set, runlevel will output the values from these instead. Thus runlevel can be used in rc scripts as a replacement for the System-V who(1) -r command.
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.
EXIT STATUSrunlevel will exit with status 0 if a UTMP record was found, otherwise it will exit with status 1.
- runlevel will read the current runlevel from this environment variable if set in preference to reading from /var/run/utmp
will read the previous runlevel from this environment variable if
was given, in preference to reading from /var/run/utmp
- Where the current and previous runlevels will be read from.
NOTESThe Upstart init(8) 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 runlevel(7) event, generated by either the telinit(8) or shutdown(8) tools. This event includes the new runlevel in the RUNLEVEL environment variable, as well as the previous runlevel (obtained from their own environment or from /var/run/utmp) in the PREVLEVEL variable.
AUTHORWritten by Scott James Remnant <[email protected]>
REPORTING BUGSReport bugs at <https://launchpad.net/upstart/+bugs>
COPYRIGHTCopyright © 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.
SEE ALSOrunlevel(7) init(8) telinit(8) shutdown(8) who(1)
- EXIT STATUS
- REPORTING BUGS
- SEE ALSO
This document was created by man2html, using the manual pages.
Time: 05:34:29 GMT, December 24, 2015