]>
Commit | Line | Data |
---|---|---|
359957ee | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
3a54a157 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
0307f791 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1+ --> |
359957ee | 5 | |
dfdebb1b | 6 | <refentry id="runlevel" |
798d3a52 | 7 | xmlns:xi="http://www.w3.org/2001/XInclude" |
3211da4b | 8 | conditional="ENABLE_UTMP"> |
798d3a52 ZJS |
9 | |
10 | <refentryinfo> | |
11 | <title>runlevel</title> | |
12 | <productname>systemd</productname> | |
798d3a52 ZJS |
13 | </refentryinfo> |
14 | ||
15 | <refmeta> | |
16 | <refentrytitle>runlevel</refentrytitle> | |
17 | <manvolnum>8</manvolnum> | |
18 | </refmeta> | |
19 | ||
20 | <refnamediv> | |
21 | <refname>runlevel</refname> | |
22 | <refpurpose>Print previous and current SysV runlevel</refpurpose> | |
23 | </refnamediv> | |
24 | ||
25 | <refsynopsisdiv> | |
26 | <cmdsynopsis> | |
9f6434a6 ZJS |
27 | <command>runlevel</command> |
28 | <arg choice="opt" rep="repeat">options</arg> | |
798d3a52 ZJS |
29 | </cmdsynopsis> |
30 | </refsynopsisdiv> | |
31 | ||
9f6434a6 ZJS |
32 | <refsect1> |
33 | <title>Overview</title> | |
34 | ||
35 | <para>"Runlevels" are an obsolete way to start and stop groups of | |
36 | services used in SysV init. systemd provides a compatibility layer | |
37 | that maps runlevels to targets, and associated binaries like | |
38 | <command>runlevel</command>. Nevertheless, only one runlevel can | |
39 | be "active" at a given time, while systemd can activate multiple | |
40 | targets concurrently, so the mapping to runlevels is confusing | |
41 | and only approximate. Runlevels should not be used in new code, | |
42 | and are mostly useful as a shorthand way to refer the matching | |
43 | systemd targets in kernel boot parameters.</para> | |
44 | ||
45 | <table> | |
46 | <title>Mapping between runlevels and systemd targets</title> | |
47 | <tgroup cols='2' align='left' colsep='1' rowsep='1'> | |
48 | <colspec colname="runlevel" /> | |
49 | <colspec colname="target" /> | |
50 | <thead> | |
51 | <row> | |
52 | <entry>Runlevel</entry> | |
53 | <entry>Target</entry> | |
54 | </row> | |
55 | </thead> | |
56 | <tbody> | |
57 | <row> | |
58 | <entry>0</entry> | |
59 | <entry><filename>poweroff.target</filename></entry> | |
60 | </row> | |
61 | <row> | |
62 | <entry>1</entry> | |
63 | <entry><filename>rescue.target</filename></entry> | |
64 | </row> | |
65 | <row> | |
66 | <entry>2, 3, 4</entry> | |
67 | <entry><filename>multi-user.target</filename></entry> | |
68 | </row> | |
69 | <row> | |
70 | <entry>5</entry> | |
71 | <entry><filename>graphical.target</filename></entry> | |
72 | </row> | |
73 | <row> | |
74 | <entry>6</entry> | |
75 | <entry><filename>reboot.target</filename></entry> | |
76 | </row> | |
77 | </tbody> | |
78 | </tgroup> | |
79 | </table> | |
80 | </refsect1> | |
81 | ||
798d3a52 ZJS |
82 | <refsect1> |
83 | <title>Description</title> | |
84 | ||
85 | <para><command>runlevel</command> prints the previous and current | |
86 | SysV runlevel if they are known.</para> | |
87 | ||
88 | <para>The two runlevel characters are separated by a single space | |
89 | character. If a runlevel cannot be determined, N is printed | |
90 | instead. If neither can be determined, the word "unknown" is | |
91 | printed.</para> | |
92 | ||
93 | <para>Unless overridden in the environment, this will check the | |
94 | utmp database for recent runlevel changes.</para> | |
95 | </refsect1> | |
96 | ||
97 | <refsect1> | |
98 | <title>Options</title> | |
99 | ||
100 | <para>The following option is understood:</para> | |
101 | ||
102 | <variablelist> | |
103 | <varlistentry> | |
104 | <term><option>--help</option></term> | |
105 | ||
106 | <xi:include href="standard-options.xml" xpointer="help-text" /> | |
107 | </varlistentry> | |
108 | </variablelist> | |
109 | ||
110 | </refsect1> | |
111 | ||
112 | <refsect1> | |
113 | <title>Exit status</title> | |
114 | ||
115 | <para>If one or both runlevels could be determined, 0 is returned, | |
116 | a non-zero failure code otherwise.</para> | |
117 | ||
118 | </refsect1> | |
119 | ||
120 | <refsect1> | |
121 | <title>Environment</title> | |
122 | ||
123 | <variablelist class='environment-variables'> | |
124 | <varlistentry> | |
125 | <term><varname>$RUNLEVEL</varname></term> | |
126 | ||
127 | <listitem><para>If <varname>$RUNLEVEL</varname> is set, | |
128 | <command>runlevel</command> will print this value as current | |
129 | runlevel and ignore utmp.</para></listitem> | |
130 | </varlistentry> | |
131 | ||
132 | <varlistentry> | |
133 | <term><varname>$PREVLEVEL</varname></term> | |
134 | ||
135 | <listitem><para>If <varname>$PREVLEVEL</varname> is set, | |
136 | <command>runlevel</command> will print this value as previous | |
137 | runlevel and ignore utmp.</para></listitem> | |
138 | </varlistentry> | |
139 | </variablelist> | |
140 | </refsect1> | |
141 | ||
142 | <refsect1> | |
143 | <title>Files</title> | |
144 | ||
145 | <variablelist> | |
146 | <varlistentry> | |
8c095a07 | 147 | <term><filename>/run/utmp</filename></term> |
798d3a52 | 148 | |
8c095a07 | 149 | <listitem><para>The utmp database <command>runlevel</command> reads the previous and current runlevel |
798d3a52 ZJS |
150 | from.</para></listitem> |
151 | </varlistentry> | |
152 | </variablelist> | |
153 | </refsect1> | |
154 | ||
798d3a52 ZJS |
155 | <refsect1> |
156 | <title>See Also</title> | |
157 | <para> | |
158 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
9f6434a6 | 159 | <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
798d3a52 ZJS |
160 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
161 | </para> | |
162 | </refsect1> | |
359957ee LP |
163 | |
164 | </refentry> |