1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 This file is part of systemd.
8 Copyright 2010 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id="runlevel">
27 <title>runlevel</title>
28 <productname>systemd</productname>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
41 <refentrytitle>runlevel</refentrytitle>
42 <manvolnum>8</manvolnum>
46 <refname>runlevel</refname>
47 <refpurpose>Print previous and current SysV runlevel</refpurpose>
52 <command>runlevel <arg choice="opt" rep="repeat">options</arg></command>
57 <title>Description</title>
59 <para><command>runlevel</command> prints the previous
60 and current SysV runlevel if they are known.</para>
62 <para>The two runlevel characters are separated by a
63 single space character. If a runlevel cannot be
64 determined, N is printed instead. If neither can be
65 determined, the word "unknown" is printed.</para>
67 <para>Unless overridden in the environment, this will
68 check the utmp database for recent runlevel
73 <title>Options</title>
75 <para>The following option is understood:</para>
79 <term><option>--help</option></term>
81 <listitem><para>Prints a short help
82 text and exits.</para></listitem>
89 <title>Exit status</title>
91 <para>If one or both runlevels could be determined, 0
92 is returned, a non-zero failure code otherwise.</para>
97 <title>Environment</title>
101 <term><varname>$RUNLEVEL</varname></term>
104 <varname>$RUNLEVEL</varname> is set,
105 <command>runlevel</command> will print
106 this value as current runlevel and
107 ignore utmp.</para></listitem>
111 <term><varname>$PREVLEVEL</varname></term>
114 <varname>$PREVLEVEL</varname> is set
115 <command>runlevel</command> will print
116 this value as previous runlevel and
117 ignore utmp.</para></listitem>
127 <term><varname>/var/run/utmp</varname></term>
129 <listitem><para>The utmp database
130 <command>runlevel</command> reads the
131 previous and current runlevel
132 from.</para></listitem>
141 <para>This is a legacy command available for compatibility
142 only. It should not be used anymore, as the concept of
143 runlevels is obsolete.</para>
147 <title>See Also</title>
149 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
150 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>