| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# This file is part of Config-Model-Systemd |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# This software is Copyright (c) 2008-2022 by Dominique Dumont. |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# This is free software, licensed under: |
|
7
|
|
|
|
|
|
|
# |
|
8
|
|
|
|
|
|
|
# The GNU Lesser General Public License, Version 2.1, February 1999 |
|
9
|
|
|
|
|
|
|
# |
|
10
|
1
|
|
|
1
|
|
15451
|
use strict; |
|
|
1
|
|
|
1
|
|
3
|
|
|
|
1
|
|
|
|
|
35
|
|
|
|
1
|
|
|
|
|
13654
|
|
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
21
|
|
|
11
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
1
|
|
4
|
|
|
|
1
|
|
|
|
|
234
|
|
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
175
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
return [ |
|
14
|
|
|
|
|
|
|
{ |
|
15
|
|
|
|
|
|
|
'accept' => [ |
|
16
|
|
|
|
|
|
|
'.*', |
|
17
|
|
|
|
|
|
|
{ |
|
18
|
|
|
|
|
|
|
'type' => 'leaf', |
|
19
|
|
|
|
|
|
|
'value_type' => 'uniline', |
|
20
|
|
|
|
|
|
|
'warn' => '$unknown_param_msg' |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
], |
|
23
|
|
|
|
|
|
|
'element' => [ |
|
24
|
|
|
|
|
|
|
'FailureAction', |
|
25
|
|
|
|
|
|
|
{ |
|
26
|
|
|
|
|
|
|
'choice' => [ |
|
27
|
|
|
|
|
|
|
'none', |
|
28
|
|
|
|
|
|
|
'reboot', |
|
29
|
|
|
|
|
|
|
'reboot-force', |
|
30
|
|
|
|
|
|
|
'reboot-immediate', |
|
31
|
|
|
|
|
|
|
'poweroff', |
|
32
|
|
|
|
|
|
|
'poweroff-force', |
|
33
|
|
|
|
|
|
|
'poweroff-immediate', |
|
34
|
|
|
|
|
|
|
'exit', |
|
35
|
|
|
|
|
|
|
'exit-force' |
|
36
|
|
|
|
|
|
|
], |
|
37
|
|
|
|
|
|
|
'description' => 'Configure the action to take when the unit stops and enters a failed state or inactive state. |
|
38
|
|
|
|
|
|
|
Takes one of C<none>, C<reboot>, C<reboot-force>, |
|
39
|
|
|
|
|
|
|
C<reboot-immediate>, C<poweroff>, C<poweroff-force>, |
|
40
|
|
|
|
|
|
|
C<poweroff-immediate>, C<exit>, and C<exit-force>. In system mode, |
|
41
|
|
|
|
|
|
|
all options are allowed. In user mode, only C<none>, C<exit>, and |
|
42
|
|
|
|
|
|
|
C<exit-force> are allowed. Both options default to C<none>. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
If C<none> is set, no action will be triggered. C<reboot> causes a reboot |
|
45
|
|
|
|
|
|
|
following the normal shutdown procedure (i.e. equivalent to systemctl reboot). |
|
46
|
|
|
|
|
|
|
C<reboot-force> causes a forced reboot which will terminate all processes forcibly but should |
|
47
|
|
|
|
|
|
|
cause no dirty file systems on reboot (i.e. equivalent to systemctl reboot -f) and |
|
48
|
|
|
|
|
|
|
C<reboot-immediate> causes immediate execution of the |
|
49
|
|
|
|
|
|
|
L<reboot(2)> system call, which |
|
50
|
|
|
|
|
|
|
might result in data loss (i.e. equivalent to systemctl reboot -ff). Similarly, |
|
51
|
|
|
|
|
|
|
C<poweroff>, C<poweroff-force>, C<poweroff-immediate> have the effect |
|
52
|
|
|
|
|
|
|
of powering down the system with similar semantics. C<exit> causes the manager to exit following |
|
53
|
|
|
|
|
|
|
the normal shutdown procedure, and C<exit-force> causes it terminate without shutting down |
|
54
|
|
|
|
|
|
|
services. When C<exit> or C<exit-force> is used by default the exit status of the |
|
55
|
|
|
|
|
|
|
main process of the unit (if this applies) is returned from the service manager. However, this may be overridden |
|
56
|
|
|
|
|
|
|
with C<FailureActionExitStatus>/C<SuccessActionExitStatus>, see |
|
57
|
|
|
|
|
|
|
below.', |
|
58
|
|
|
|
|
|
|
'type' => 'leaf', |
|
59
|
|
|
|
|
|
|
'value_type' => 'enum' |
|
60
|
|
|
|
|
|
|
}, |
|
61
|
|
|
|
|
|
|
'SuccessAction', |
|
62
|
|
|
|
|
|
|
{ |
|
63
|
|
|
|
|
|
|
'choice' => [ |
|
64
|
|
|
|
|
|
|
'none', |
|
65
|
|
|
|
|
|
|
'reboot', |
|
66
|
|
|
|
|
|
|
'reboot-force', |
|
67
|
|
|
|
|
|
|
'reboot-immediate', |
|
68
|
|
|
|
|
|
|
'poweroff', |
|
69
|
|
|
|
|
|
|
'poweroff-force', |
|
70
|
|
|
|
|
|
|
'poweroff-immediate', |
|
71
|
|
|
|
|
|
|
'exit', |
|
72
|
|
|
|
|
|
|
'exit-force' |
|
73
|
|
|
|
|
|
|
], |
|
74
|
|
|
|
|
|
|
'description' => 'Configure the action to take when the unit stops and enters a failed state or inactive state. |
|
75
|
|
|
|
|
|
|
Takes one of C<none>, C<reboot>, C<reboot-force>, |
|
76
|
|
|
|
|
|
|
C<reboot-immediate>, C<poweroff>, C<poweroff-force>, |
|
77
|
|
|
|
|
|
|
C<poweroff-immediate>, C<exit>, and C<exit-force>. In system mode, |
|
78
|
|
|
|
|
|
|
all options are allowed. In user mode, only C<none>, C<exit>, and |
|
79
|
|
|
|
|
|
|
C<exit-force> are allowed. Both options default to C<none>. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
If C<none> is set, no action will be triggered. C<reboot> causes a reboot |
|
82
|
|
|
|
|
|
|
following the normal shutdown procedure (i.e. equivalent to systemctl reboot). |
|
83
|
|
|
|
|
|
|
C<reboot-force> causes a forced reboot which will terminate all processes forcibly but should |
|
84
|
|
|
|
|
|
|
cause no dirty file systems on reboot (i.e. equivalent to systemctl reboot -f) and |
|
85
|
|
|
|
|
|
|
C<reboot-immediate> causes immediate execution of the |
|
86
|
|
|
|
|
|
|
L<reboot(2)> system call, which |
|
87
|
|
|
|
|
|
|
might result in data loss (i.e. equivalent to systemctl reboot -ff). Similarly, |
|
88
|
|
|
|
|
|
|
C<poweroff>, C<poweroff-force>, C<poweroff-immediate> have the effect |
|
89
|
|
|
|
|
|
|
of powering down the system with similar semantics. C<exit> causes the manager to exit following |
|
90
|
|
|
|
|
|
|
the normal shutdown procedure, and C<exit-force> causes it terminate without shutting down |
|
91
|
|
|
|
|
|
|
services. When C<exit> or C<exit-force> is used by default the exit status of the |
|
92
|
|
|
|
|
|
|
main process of the unit (if this applies) is returned from the service manager. However, this may be overridden |
|
93
|
|
|
|
|
|
|
with C<FailureActionExitStatus>/C<SuccessActionExitStatus>, see |
|
94
|
|
|
|
|
|
|
below.', |
|
95
|
|
|
|
|
|
|
'type' => 'leaf', |
|
96
|
|
|
|
|
|
|
'value_type' => 'enum' |
|
97
|
|
|
|
|
|
|
}, |
|
98
|
|
|
|
|
|
|
'StartLimitBurst', |
|
99
|
|
|
|
|
|
|
{ |
|
100
|
|
|
|
|
|
|
'description' => 'Configure unit start rate limiting. Units which are started more than |
|
101
|
|
|
|
|
|
|
burst times within an interval time span are |
|
102
|
|
|
|
|
|
|
not permitted to start any more. Use C<StartLimitIntervalSec> to configure the |
|
103
|
|
|
|
|
|
|
checking interval and C<StartLimitBurst> to configure how many starts per interval |
|
104
|
|
|
|
|
|
|
are allowed. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
interval is a time span with the default unit of seconds, but other |
|
107
|
|
|
|
|
|
|
units may be specified, see |
|
108
|
|
|
|
|
|
|
L<systemd.time(5)>. |
|
109
|
|
|
|
|
|
|
Defaults to C<DefaultStartLimitIntervalSec> in manager configuration file, and may |
|
110
|
|
|
|
|
|
|
be set to 0 to disable any kind of rate limiting. burst is a number and |
|
111
|
|
|
|
|
|
|
defaults to C<DefaultStartLimitBurst> in manager configuration file. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
These configuration options are particularly useful in conjunction with the service setting |
|
114
|
|
|
|
|
|
|
C<Restart> (see |
|
115
|
|
|
|
|
|
|
L<systemd.service(5)>); |
|
116
|
|
|
|
|
|
|
however, they apply to all kinds of starts (including manual), not just those triggered by the |
|
117
|
|
|
|
|
|
|
C<Restart> logic. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Note that units which are configured for C<Restart>, and which reach the start |
|
120
|
|
|
|
|
|
|
limit are not attempted to be restarted anymore; however, they may still be restarted manually or |
|
121
|
|
|
|
|
|
|
from a timer or socket at a later point, after the interval has passed. |
|
122
|
|
|
|
|
|
|
From that point on, the restart logic is activated again. systemctl reset-failed |
|
123
|
|
|
|
|
|
|
will cause the restart rate counter for a service to be flushed, which is useful if the administrator |
|
124
|
|
|
|
|
|
|
wants to manually start a unit and the start limit interferes with that. Rate-limiting is enforced |
|
125
|
|
|
|
|
|
|
after any unit condition checks are executed, and hence unit activations with failing conditions do |
|
126
|
|
|
|
|
|
|
not count towards the rate limit. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
When a unit is unloaded due to the garbage collection logic (see above) its rate limit counters |
|
129
|
|
|
|
|
|
|
are flushed out too. This means that configuring start rate limiting for a unit that is not |
|
130
|
|
|
|
|
|
|
referenced continuously has no effect. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
This setting does not apply to slice, target, device, and scope units, since they are unit |
|
133
|
|
|
|
|
|
|
types whose activation may either never fail, or may succeed only a single time.', |
|
134
|
|
|
|
|
|
|
'type' => 'leaf', |
|
135
|
|
|
|
|
|
|
'value_type' => 'uniline' |
|
136
|
|
|
|
|
|
|
}, |
|
137
|
|
|
|
|
|
|
'StartLimitIntervalSec', |
|
138
|
|
|
|
|
|
|
{ |
|
139
|
|
|
|
|
|
|
'description' => 'Configure unit start rate limiting. Units which are started more than |
|
140
|
|
|
|
|
|
|
burst times within an interval time span are |
|
141
|
|
|
|
|
|
|
not permitted to start any more. Use C<StartLimitIntervalSec> to configure the |
|
142
|
|
|
|
|
|
|
checking interval and C<StartLimitBurst> to configure how many starts per interval |
|
143
|
|
|
|
|
|
|
are allowed. |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
interval is a time span with the default unit of seconds, but other |
|
146
|
|
|
|
|
|
|
units may be specified, see |
|
147
|
|
|
|
|
|
|
L<systemd.time(5)>. |
|
148
|
|
|
|
|
|
|
Defaults to C<DefaultStartLimitIntervalSec> in manager configuration file, and may |
|
149
|
|
|
|
|
|
|
be set to 0 to disable any kind of rate limiting. burst is a number and |
|
150
|
|
|
|
|
|
|
defaults to C<DefaultStartLimitBurst> in manager configuration file. |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
These configuration options are particularly useful in conjunction with the service setting |
|
153
|
|
|
|
|
|
|
C<Restart> (see |
|
154
|
|
|
|
|
|
|
L<systemd.service(5)>); |
|
155
|
|
|
|
|
|
|
however, they apply to all kinds of starts (including manual), not just those triggered by the |
|
156
|
|
|
|
|
|
|
C<Restart> logic. |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Note that units which are configured for C<Restart>, and which reach the start |
|
159
|
|
|
|
|
|
|
limit are not attempted to be restarted anymore; however, they may still be restarted manually or |
|
160
|
|
|
|
|
|
|
from a timer or socket at a later point, after the interval has passed. |
|
161
|
|
|
|
|
|
|
From that point on, the restart logic is activated again. systemctl reset-failed |
|
162
|
|
|
|
|
|
|
will cause the restart rate counter for a service to be flushed, which is useful if the administrator |
|
163
|
|
|
|
|
|
|
wants to manually start a unit and the start limit interferes with that. Rate-limiting is enforced |
|
164
|
|
|
|
|
|
|
after any unit condition checks are executed, and hence unit activations with failing conditions do |
|
165
|
|
|
|
|
|
|
not count towards the rate limit. |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
When a unit is unloaded due to the garbage collection logic (see above) its rate limit counters |
|
168
|
|
|
|
|
|
|
are flushed out too. This means that configuring start rate limiting for a unit that is not |
|
169
|
|
|
|
|
|
|
referenced continuously has no effect. |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
This setting does not apply to slice, target, device, and scope units, since they are unit |
|
172
|
|
|
|
|
|
|
types whose activation may either never fail, or may succeed only a single time.', |
|
173
|
|
|
|
|
|
|
'type' => 'leaf', |
|
174
|
|
|
|
|
|
|
'value_type' => 'uniline' |
|
175
|
|
|
|
|
|
|
}, |
|
176
|
|
|
|
|
|
|
'RebootArgument', |
|
177
|
|
|
|
|
|
|
{ |
|
178
|
|
|
|
|
|
|
'description' => 'Configure the optional argument for the |
|
179
|
|
|
|
|
|
|
L<reboot(2)> system call if |
|
180
|
|
|
|
|
|
|
C<StartLimitAction> or C<FailureAction> is a reboot action. This |
|
181
|
|
|
|
|
|
|
works just like the optional argument to systemctl reboot command.', |
|
182
|
|
|
|
|
|
|
'type' => 'leaf', |
|
183
|
|
|
|
|
|
|
'value_type' => 'uniline' |
|
184
|
|
|
|
|
|
|
} |
|
185
|
|
|
|
|
|
|
], |
|
186
|
|
|
|
|
|
|
'include' => [ |
|
187
|
|
|
|
|
|
|
'Systemd::Section::Unit' |
|
188
|
|
|
|
|
|
|
], |
|
189
|
|
|
|
|
|
|
'name' => 'Systemd::Section::SocketUnit' |
|
190
|
|
|
|
|
|
|
} |
|
191
|
|
|
|
|
|
|
] |
|
192
|
|
|
|
|
|
|
; |
|
193
|
|
|
|
|
|
|
|