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