1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
'\" t
.TH "RUNLEVEL" "8" "" "systemd 255" "runlevel"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
runlevel \- Print previous and current SysV runlevel
.SH "SYNOPSIS"
.HP \w'\fBrunlevel\fR\ 'u
\fBrunlevel\fR [options...]
.SH "OVERVIEW"
.PP
"Runlevels" are an obsolete way to start and stop groups of services used in SysV init\&. systemd provides a compatibility layer that maps runlevels to targets, and associated binaries like
\fBrunlevel\fR\&. Nevertheless, only one runlevel can be "active" at a given time, while systemd can activate multiple targets concurrently, so the mapping to runlevels is confusing and only approximate\&. Runlevels should not be used in new code, and are mostly useful as a shorthand way to refer the matching systemd targets in kernel boot parameters\&.
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.B Table\ \&1.\ \&Mapping between runlevels and systemd targets
.TS
allbox tab(:);
lB lB.
T{
Runlevel
T}:T{
Target
T}
.T&
l l
l l
l l
l l
l l.
T{
0
T}:T{
poweroff\&.target
T}
T{
1
T}:T{
rescue\&.target
T}
T{
2, 3, 4
T}:T{
multi\-user\&.target
T}
T{
5
T}:T{
graphical\&.target
T}
T{
6
T}:T{
reboot\&.target
T}
.TE
.sp 1
.SH "DESCRIPTION"
.PP
\fBrunlevel\fR
prints the previous and current SysV runlevel if they are known\&.
.PP
The two runlevel characters are separated by a single space character\&. If a runlevel cannot be determined, N is printed instead\&. If neither can be determined, the word "unknown" is printed\&.
.PP
Unless overridden in the environment, this will check the utmp database for recent runlevel changes\&.
.SH "OPTIONS"
.PP
The following option is understood:
.PP
\fB\-\-help\fR
.RS 4
Print a short help text and exit\&.
.RE
.SH "EXIT STATUS"
.PP
If one or both runlevels could be determined, 0 is returned, a non\-zero failure code otherwise\&.
.SH "ENVIRONMENT"
.PP
\fI$RUNLEVEL\fR
.RS 4
If
\fI$RUNLEVEL\fR
is set,
\fBrunlevel\fR
will print this value as current runlevel and ignore utmp\&.
.RE
.PP
\fI$PREVLEVEL\fR
.RS 4
If
\fI$PREVLEVEL\fR
is set,
\fBrunlevel\fR
will print this value as previous runlevel and ignore utmp\&.
.RE
.SH "FILES"
.PP
/run/utmp
.RS 4
The utmp database
\fBrunlevel\fR
reads the previous and current runlevel from\&.
.sp
Added in version 237\&.
.RE
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1),
\fBsystemd.target\fR(5),
\fBsystemctl\fR(1)
|