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="systemd">
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 seperated 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 overriden in the environment this will
68 check the utmp database for recent runlevel
71 <para>The following option is understood:</para>
77 <listitem><para>Prints a short help
78 text and exits.</para></listitem>
85 <title>Exit status</title>
87 <para>If one or both runlevels could be determined, 0
88 is returned, a non-zero failure code otherwise.</para>
93 <title>Environment</title>
97 <term><varname>$RUNLEVEL</varname></term>
100 <varname>$RUNLEVEL</varname> is set,
101 <command>runlevel</command> will print
102 this value as current runlevel and
103 ignore utmp.</para></listitem>
107 <term><varname>$PREVLEVEL</varname></term>
110 <varname>$PREVLEVEL</varname> is set
111 <command>runlevel</command> will print
112 this value as previous runlevel and
113 ignore utmp.</para></listitem>
123 <term><varname>/var/run/utmp</varname></term>
125 <listitem><para>The utmp database
126 <command>runlevel</command> reads the
127 previous and current runlevel
128 from.</para></listitem>
137 <para>This is a legacy call available for compatbility
138 only. It should not be used anymore, as the concept of
139 runlevels is obselete.</para>
143 <title>See Also</title>
145 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,