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 Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id="runlevel"
25 xmlns:xi="http://www.w3.org/2001/XInclude"
26 conditional="HAVE_UTMP">
29 <title>runlevel</title>
30 <productname>systemd</productname>
34 <contrib>Developer</contrib>
35 <firstname>Lennart</firstname>
36 <surname>Poettering</surname>
37 <email>lennart@poettering.net</email>
43 <refentrytitle>runlevel</refentrytitle>
44 <manvolnum>8</manvolnum>
48 <refname>runlevel</refname>
49 <refpurpose>Print previous and current SysV runlevel</refpurpose>
54 <command>runlevel <arg choice="opt" rep="repeat">options</arg></command>
59 <title>Description</title>
61 <para><command>runlevel</command> prints the previous
62 and current SysV runlevel if they are known.</para>
64 <para>The two runlevel characters are separated by a
65 single space character. If a runlevel cannot be
66 determined, N is printed instead. If neither can be
67 determined, the word "unknown" is printed.</para>
69 <para>Unless overridden in the environment, this will
70 check the utmp database for recent runlevel
75 <title>Options</title>
77 <para>The following option is understood:</para>
81 <term><option>--help</option></term>
83 <xi:include href="standard-options.xml" xpointer="help-text" />
90 <title>Exit status</title>
92 <para>If one or both runlevels could be determined, 0
93 is returned, a non-zero failure code otherwise.</para>
98 <title>Environment</title>
100 <variablelist class='environment-variables'>
102 <term><varname>$RUNLEVEL</varname></term>
105 <varname>$RUNLEVEL</varname> is set,
106 <command>runlevel</command> will print
107 this value as current runlevel and
108 ignore utmp.</para></listitem>
112 <term><varname>$PREVLEVEL</varname></term>
115 <varname>$PREVLEVEL</varname> is set,
116 <command>runlevel</command> will print
117 this value as previous runlevel and
118 ignore utmp.</para></listitem>
128 <term><filename>/var/run/utmp</filename></term>
130 <listitem><para>The utmp database
131 <command>runlevel</command> reads the
132 previous and current runlevel
133 from.</para></listitem>
142 <para>This is a legacy command available for compatibility
143 only. It should not be used anymore, as the concept of
144 runlevels is obsolete.</para>
148 <title>See Also</title>
150 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
151 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>