]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/runlevel.xml
verify: use manager_load_startable_unit_or_warn() to load units for verification
[thirdparty/systemd.git] / man / runlevel.xml
CommitLineData
359957ee
LP
1<?xml version='1.0'?> <!--*-nxml-*-->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
359957ee
LP
4
5<!--
572eb058
ZJS
6 SPDX-License-Identifier: LGPL-2.1+
7
359957ee
LP
8 This file is part of systemd.
9
10 Copyright 2010 Lennart Poettering
11
12 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
359957ee
LP
15 (at your option) any later version.
16
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 20 Lesser General Public License for more details.
359957ee 21
5430f7f2 22 You should have received a copy of the GNU Lesser General Public License
359957ee
LP
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24-->
25
dfdebb1b 26<refentry id="runlevel"
798d3a52 27 xmlns:xi="http://www.w3.org/2001/XInclude"
3211da4b 28 conditional="ENABLE_UTMP">
798d3a52
ZJS
29
30 <refentryinfo>
31 <title>runlevel</title>
32 <productname>systemd</productname>
33
34 <authorgroup>
35 <author>
36 <contrib>Developer</contrib>
37 <firstname>Lennart</firstname>
38 <surname>Poettering</surname>
39 <email>lennart@poettering.net</email>
40 </author>
41 </authorgroup>
42 </refentryinfo>
43
44 <refmeta>
45 <refentrytitle>runlevel</refentrytitle>
46 <manvolnum>8</manvolnum>
47 </refmeta>
48
49 <refnamediv>
50 <refname>runlevel</refname>
51 <refpurpose>Print previous and current SysV runlevel</refpurpose>
52 </refnamediv>
53
54 <refsynopsisdiv>
55 <cmdsynopsis>
9f6434a6
ZJS
56 <command>runlevel</command>
57 <arg choice="opt" rep="repeat">options</arg>
798d3a52
ZJS
58 </cmdsynopsis>
59 </refsynopsisdiv>
60
9f6434a6
ZJS
61 <refsect1>
62 <title>Overview</title>
63
64 <para>"Runlevels" are an obsolete way to start and stop groups of
65 services used in SysV init. systemd provides a compatibility layer
66 that maps runlevels to targets, and associated binaries like
67 <command>runlevel</command>. Nevertheless, only one runlevel can
68 be "active" at a given time, while systemd can activate multiple
69 targets concurrently, so the mapping to runlevels is confusing
70 and only approximate. Runlevels should not be used in new code,
71 and are mostly useful as a shorthand way to refer the matching
72 systemd targets in kernel boot parameters.</para>
73
74 <table>
75 <title>Mapping between runlevels and systemd targets</title>
76 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
77 <colspec colname="runlevel" />
78 <colspec colname="target" />
79 <thead>
80 <row>
81 <entry>Runlevel</entry>
82 <entry>Target</entry>
83 </row>
84 </thead>
85 <tbody>
86 <row>
87 <entry>0</entry>
88 <entry><filename>poweroff.target</filename></entry>
89 </row>
90 <row>
91 <entry>1</entry>
92 <entry><filename>rescue.target</filename></entry>
93 </row>
94 <row>
95 <entry>2, 3, 4</entry>
96 <entry><filename>multi-user.target</filename></entry>
97 </row>
98 <row>
99 <entry>5</entry>
100 <entry><filename>graphical.target</filename></entry>
101 </row>
102 <row>
103 <entry>6</entry>
104 <entry><filename>reboot.target</filename></entry>
105 </row>
106 </tbody>
107 </tgroup>
108 </table>
109 </refsect1>
110
798d3a52
ZJS
111 <refsect1>
112 <title>Description</title>
113
114 <para><command>runlevel</command> prints the previous and current
115 SysV runlevel if they are known.</para>
116
117 <para>The two runlevel characters are separated by a single space
118 character. If a runlevel cannot be determined, N is printed
119 instead. If neither can be determined, the word "unknown" is
120 printed.</para>
121
122 <para>Unless overridden in the environment, this will check the
123 utmp database for recent runlevel changes.</para>
124 </refsect1>
125
126 <refsect1>
127 <title>Options</title>
128
129 <para>The following option is understood:</para>
130
131 <variablelist>
132 <varlistentry>
133 <term><option>--help</option></term>
134
135 <xi:include href="standard-options.xml" xpointer="help-text" />
136 </varlistentry>
137 </variablelist>
138
139 </refsect1>
140
141 <refsect1>
142 <title>Exit status</title>
143
144 <para>If one or both runlevels could be determined, 0 is returned,
145 a non-zero failure code otherwise.</para>
146
147 </refsect1>
148
149 <refsect1>
150 <title>Environment</title>
151
152 <variablelist class='environment-variables'>
153 <varlistentry>
154 <term><varname>$RUNLEVEL</varname></term>
155
156 <listitem><para>If <varname>$RUNLEVEL</varname> is set,
157 <command>runlevel</command> will print this value as current
158 runlevel and ignore utmp.</para></listitem>
159 </varlistentry>
160
161 <varlistentry>
162 <term><varname>$PREVLEVEL</varname></term>
163
164 <listitem><para>If <varname>$PREVLEVEL</varname> is set,
165 <command>runlevel</command> will print this value as previous
166 runlevel and ignore utmp.</para></listitem>
167 </varlistentry>
168 </variablelist>
169 </refsect1>
170
171 <refsect1>
172 <title>Files</title>
173
174 <variablelist>
175 <varlistentry>
8c095a07 176 <term><filename>/run/utmp</filename></term>
798d3a52 177
8c095a07 178 <listitem><para>The utmp database <command>runlevel</command> reads the previous and current runlevel
798d3a52
ZJS
179 from.</para></listitem>
180 </varlistentry>
181 </variablelist>
182 </refsect1>
183
798d3a52
ZJS
184 <refsect1>
185 <title>See Also</title>
186 <para>
187 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
9f6434a6 188 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
798d3a52
ZJS
189 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
190 </para>
191 </refsect1>
359957ee
LP
192
193</refentry>