File Coverage

blib/lib/Config/Model/models/Systemd/Section/Service.pl
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 24 24 100.0


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 4     4   24181 use strict;
  4     1   9  
  4     1   155  
  1         3440  
  1         2  
  1         23  
  1         3400  
  1         2  
  1         20  
11 4     4   20 use warnings;
  4     1   10  
  4     1   3372  
  1         5  
  1         1  
  1         863  
  1         5  
  1         2  
  1         871  
12              
13             return [
14             {
15             'accept' => [
16             '.*',
17             {
18             'type' => 'leaf',
19             'value_type' => 'uniline',
20             'warn' => 'Unexpected systemd parameter. Please contact cme author to update systemd model.'
21             }
22             ],
23             'class_description' => 'A unit configuration file whose name ends in
24             C<.service> encodes information about a process
25             controlled and supervised by systemd.
26              
27             This man page lists the configuration options specific to
28             this unit type. See
29             L<systemd.unit(5)>
30             for the common options of all unit configuration files. The common
31             configuration items are configured in the generic
32             [Unit] and [Install]
33             sections. The service specific configuration options are
34             configured in the [Service] section.
35              
36             Additional options are listed in
37             L<systemd.exec(5)>,
38             which define the execution environment the commands are executed
39             in, and in
40             L<systemd.kill(5)>,
41             which define the way the processes of the service are terminated,
42             and in
43             L<systemd.resource-control(5)>,
44             which configure resource control settings for the processes of the
45             service.
46              
47             If SysV init compat is enabled, systemd automatically creates service units that wrap SysV init
48             scripts (the service name is the same as the name of the script, with a C<.service>
49             suffix added); see
50             L<systemd-sysv-generator(8)>.
51              
52              
53             The L<systemd-run(1)>
54             command allows creating C<.service> and C<.scope> units dynamically
55             and transiently from the command line.
56             This configuration class was generated from systemd documentation.
57             by L<parse-man.pl|https://github.com/dod38fr/config-model-systemd/contrib/parse-man.pl>
58             ',
59             'copyright' => [
60             '2010-2016 Lennart Poettering and others',
61             '2016 Dominique Dumont'
62             ],
63             'element' => [
64             'Type',
65             {
66             'description' => "Configures the process start-up type for this service unit. One of C<simple>,
67             C<exec>, C<forking>, C<oneshot>, C<dbus>,
68             C<notify> or C<idle>:
69              
70             It is generally recommended to use C<Type>C<simple> for long-running
71             services whenever possible, as it is the simplest and fastest option. However, as this service type won't
72             propagate service start-up failures and doesn't allow ordering of other units against completion of
73             initialization of the service (which for example is useful if clients need to connect to the service through
74             some form of IPC, and the IPC channel is only established by the service itself \x{2014} in contrast to doing this
75             ahead of time through socket or bus activation or similar), it might not be sufficient for many cases. If so,
76             C<notify> or C<dbus> (the latter only in case the service provides a D-Bus
77             interface) are the preferred options as they allow service program code to precisely schedule when to
78             consider the service started up successfully and when to proceed with follow-up units. The
79             C<notify> service type requires explicit support in the service codebase (as
80             sd_notify() or an equivalent API needs to be invoked by the service at the appropriate
81             time) \x{2014} if it's not supported, then C<forking> is an alternative: it supports the traditional
82             UNIX service start-up protocol. Finally, C<exec> might be an option for cases where it is
83             enough to ensure the service binary is invoked, and where the service binary itself executes no or little
84             initialization on its own (and its initialization is unlikely to fail). Note that using any type other than
85             C<simple> possibly delays the boot process, as the service manager needs to wait for service
86             initialization to complete. It is hence recommended not to needlessly use any types other than
87             C<simple>. (Also note it is generally not recommended to use C<idle> or
88             C<oneshot> for long-running services.)",
89             'type' => 'leaf',
90             'value_type' => 'uniline'
91             },
92             'ExitType',
93             {
94             'description' => 'Specifies when the manager should consider the service to be finished. One of C<main> or
95             C<cgroup>:
96              
97             It is generally recommended to use C<ExitType>C<main> when a service has
98             a known forking model and a main process can reliably be determined. C<ExitType>C<cgroup> is meant for applications
99             whose forking model is not known ahead of time and which
100             might not have a specific main process. It is well suited for transient or automatically generated services,
101             such as graphical applications inside of a desktop environment.',
102             'type' => 'leaf',
103             'value_type' => 'uniline'
104             },
105             'RemainAfterExit',
106             {
107             'description' => 'Takes a boolean value that specifies whether
108             the service shall be considered active even when all its
109             processes exited. Defaults to C<no>.',
110             'type' => 'leaf',
111             'value_type' => 'boolean',
112             'write_as' => [
113             'no',
114             'yes'
115             ]
116             },
117             'GuessMainPID',
118             {
119             'description' => 'Takes a boolean value that specifies whether
120             systemd should try to guess the main PID of a service if it
121             cannot be determined reliably. This option is ignored unless
122             C<Type=forking> is set and
123             C<PIDFile> is unset because for the other types
124             or with an explicitly configured PID file, the main PID is
125             always known. The guessing algorithm might come to incorrect
126             conclusions if a daemon consists of more than one process. If
127             the main PID cannot be determined, failure detection and
128             automatic restarting of a service will not work reliably.
129             Defaults to C<yes>.',
130             'type' => 'leaf',
131             'value_type' => 'boolean',
132             'write_as' => [
133             'no',
134             'yes'
135             ]
136             },
137             'PIDFile',
138             {
139             'description' => 'Takes a path referring to the PID file of the service. Usage of this option is recommended for
140             services where C<Type> is set to C<forking>. The path specified typically points
141             to a file below C</run/>. If a relative path is specified it is hence prefixed with
142             C</run/>. The service manager will read the PID of the main process of the service from this
143             file after start-up of the service. The service manager will not write to the file configured here, although it
144             will remove the file after the service has shut down if it still exists. The PID file does not need to be owned
145             by a privileged user, but if it is owned by an unprivileged user additional safety restrictions are enforced:
146             the file may not be a symlink to a file owned by a different user (neither directly nor indirectly), and the
147             PID file must refer to a process already belonging to the service.
148              
149             Note that PID files should be avoided in modern projects. Use C<Type=notify> or
150             C<Type=simple> where possible, which does not require use of PID files to determine the
151             main process of a service and avoids needless forking.',
152             'type' => 'leaf',
153             'value_type' => 'uniline'
154             },
155             'BusName',
156             {
157             'description' => 'Takes a D-Bus destination name that this service shall use. This option is mandatory
158             for services where C<Type> is set to C<dbus>. It is recommended to
159             always set this property if known to make it easy to map the service name to the D-Bus destination.
160             In particular, systemctl service-log-level/service-log-target verbs make use of
161             this.',
162             'type' => 'leaf',
163             'value_type' => 'uniline'
164             },
165             'ExecStart',
166             {
167             'cargo' => {
168             'type' => 'leaf',
169             'value_type' => 'uniline'
170             },
171             'description' => 'Commands with their arguments that are
172             executed when this service is started. The value is split into
173             zero or more command lines according to the rules described
174             below (see section "Command Lines" below).
175              
176             Unless C<Type> is C<oneshot>, exactly one command must be given. When
177             C<Type=oneshot> is used, zero or more commands may be specified. Commands may be specified by
178             providing multiple command lines in the same directive, or alternatively, this directive may be specified more
179             than once with the same effect. If the empty string is assigned to this option, the list of commands to start
180             is reset, prior assignments of this option will have no effect. If no C<ExecStart> is
181             specified, then the service must have C<RemainAfterExit=yes> and at least one
182             C<ExecStop> line set. (Services lacking both C<ExecStart> and
183             C<ExecStop> are not valid.)
184              
185             For each of the specified commands, the first argument must be either an absolute path to an executable
186             or a simple file name without any slashes. Optionally, this filename may be prefixed with a number of special
187             characters:
188              
189             C<@>, C<->, C<:>, and one of
190             C<+>/C<!>/C<!!> may be used together and they can appear in any
191             order. However, only one of C<+>, C<!>, C<!!> may be used at a
192             time. Note that these prefixes are also supported for the other command line settings,
193             i.e. C<ExecStartPre>, C<ExecStartPost>, C<ExecReload>,
194             C<ExecStop> and C<ExecStopPost>.
195              
196             If more than one command is specified, the commands are
197             invoked sequentially in the order they appear in the unit
198             file. If one of the commands fails (and is not prefixed with
199             C<->), other lines are not executed, and the
200             unit is considered failed.
201              
202             Unless C<Type=forking> is set, the
203             process started via this command line will be considered the
204             main process of the daemon.',
205             'type' => 'list'
206             },
207             'ExecStartPre',
208             {
209             'cargo' => {
210             'type' => 'leaf',
211             'value_type' => 'uniline'
212             },
213             'description' => 'Additional commands that are executed before
214             or after the command in C<ExecStart>,
215             respectively. Syntax is the same as for
216             C<ExecStart>, except that multiple command
217             lines are allowed and the commands are executed one after the
218             other, serially.
219              
220             If any of those commands (not prefixed with
221             C<->) fail, the rest are not executed and the
222             unit is considered failed.
223              
224             C<ExecStart> commands are only run after
225             all C<ExecStartPre> commands that were not prefixed
226             with a C<-> exit successfully.
227              
228             C<ExecStartPost> commands are only run after the commands specified in
229             C<ExecStart> have been invoked successfully, as determined by C<Type>
230             (i.e. the process has been started for C<Type=simple> or C<Type=idle>, the last
231             C<ExecStart> process exited successfully for C<Type=oneshot>, the initial
232             process exited successfully for C<Type=forking>, C<READY=1> is sent for
233             C<Type=notify>, or the C<BusName> has been taken for
234             C<Type=dbus>).
235              
236             Note that C<ExecStartPre> may not be
237             used to start long-running processes. All processes forked
238             off by processes invoked via C<ExecStartPre> will
239             be killed before the next service process is run.
240              
241             Note that if any of the commands specified in C<ExecStartPre>,
242             C<ExecStart>, or C<ExecStartPost> fail (and are not prefixed with
243             C<->, see above) or time out before the service is fully up, execution continues with commands
244             specified in C<ExecStopPost>, the commands in C<ExecStop> are skipped.
245              
246             Note that the execution of C<ExecStartPost> is taken into account for the purpose of
247             C<Before>/C<After> ordering constraints.',
248             'type' => 'list'
249             },
250             'ExecStartPost',
251             {
252             'cargo' => {
253             'type' => 'leaf',
254             'value_type' => 'uniline'
255             },
256             'description' => 'Additional commands that are executed before
257             or after the command in C<ExecStart>,
258             respectively. Syntax is the same as for
259             C<ExecStart>, except that multiple command
260             lines are allowed and the commands are executed one after the
261             other, serially.
262              
263             If any of those commands (not prefixed with
264             C<->) fail, the rest are not executed and the
265             unit is considered failed.
266              
267             C<ExecStart> commands are only run after
268             all C<ExecStartPre> commands that were not prefixed
269             with a C<-> exit successfully.
270              
271             C<ExecStartPost> commands are only run after the commands specified in
272             C<ExecStart> have been invoked successfully, as determined by C<Type>
273             (i.e. the process has been started for C<Type=simple> or C<Type=idle>, the last
274             C<ExecStart> process exited successfully for C<Type=oneshot>, the initial
275             process exited successfully for C<Type=forking>, C<READY=1> is sent for
276             C<Type=notify>, or the C<BusName> has been taken for
277             C<Type=dbus>).
278              
279             Note that C<ExecStartPre> may not be
280             used to start long-running processes. All processes forked
281             off by processes invoked via C<ExecStartPre> will
282             be killed before the next service process is run.
283              
284             Note that if any of the commands specified in C<ExecStartPre>,
285             C<ExecStart>, or C<ExecStartPost> fail (and are not prefixed with
286             C<->, see above) or time out before the service is fully up, execution continues with commands
287             specified in C<ExecStopPost>, the commands in C<ExecStop> are skipped.
288              
289             Note that the execution of C<ExecStartPost> is taken into account for the purpose of
290             C<Before>/C<After> ordering constraints.',
291             'type' => 'list'
292             },
293             'ExecCondition',
294             {
295             'cargo' => {
296             'type' => 'leaf',
297             'value_type' => 'uniline'
298             },
299             'description' => 'Optional commands that are executed before the commands in C<ExecStartPre>.
300             Syntax is the same as for C<ExecStart>, except that multiple command lines are allowed and the
301             commands are executed one after the other, serially.
302              
303             The behavior is like an C<ExecStartPre> and condition check hybrid: when an
304             C<ExecCondition> command exits with exit code 1 through 254 (inclusive), the remaining
305             commands are skipped and the unit is not marked as failed. However, if an
306             C<ExecCondition> command exits with 255 or abnormally (e.g. timeout, killed by a
307             signal, etc.), the unit will be considered failed (and remaining commands will be skipped). Exit code of 0 or
308             those matching C<SuccessExitStatus> will continue execution to the next commands.
309              
310             The same recommendations about not running long-running processes in C<ExecStartPre>
311             also applies to C<ExecCondition>. C<ExecCondition> will also run the commands
312             in C<ExecStopPost>, as part of stopping the service, in the case of any non-zero or abnormal
313             exits, like the ones described above.',
314             'type' => 'list'
315             },
316             'ExecReload',
317             {
318             'cargo' => {
319             'type' => 'leaf',
320             'value_type' => 'uniline'
321             },
322             'description' => 'Commands to execute to trigger a configuration
323             reload in the service. This argument takes multiple command
324             lines, following the same scheme as described for
325             C<ExecStart> above. Use of this setting is
326             optional. Specifier and environment variable substitution is
327             supported here following the same scheme as for
328             C<ExecStart>.
329              
330             One additional, special environment variable is set: if
331             known, C<$MAINPID> is set to the main process
332             of the daemon, and may be used for command lines like the
333             following:
334              
335             Note however that reloading a daemon by sending a signal
336             (as with the example line above) is usually not a good choice,
337             because this is an asynchronous operation and hence not
338             suitable to order reloads of multiple services against each
339             other. It is strongly recommended to set
340             C<ExecReload> to a command that not only
341             triggers a configuration reload of the daemon, but also
342             synchronously waits for it to complete. For example,
343             L<dbus-broker(1)>
344             uses the following:',
345             'type' => 'list'
346             },
347             'ExecStop',
348             {
349             'cargo' => {
350             'type' => 'leaf',
351             'value_type' => 'uniline'
352             },
353             'description' => 'Commands to execute to stop the service started via
354             C<ExecStart>. This argument takes multiple command lines, following the same scheme
355             as described for C<ExecStart> above. Use of this setting is optional. After the
356             commands configured in this option are run, it is implied that the service is stopped, and any
357             processes remaining for it are terminated according to the C<KillMode> setting (see
358             L<systemd.kill(5)>).
359             If this option is not specified, the process is terminated by sending the signal specified in
360             C<KillSignal> or C<RestartKillSignal> when service stop is
361             requested. Specifier and environment variable substitution is supported (including
362             C<$MAINPID>, see above).
363              
364             Note that it is usually not sufficient to specify a command for this setting that only asks the
365             service to terminate (for example, by sending some form of termination signal to it), but does not
366             wait for it to do so. Since the remaining processes of the services are killed according to
367             C<KillMode> and C<KillSignal> or
368             C<RestartKillSignal> as described above immediately after the command exited, this
369             may not result in a clean stop. The specified command should hence be a synchronous operation, not an
370             asynchronous one.
371              
372             Note that the commands specified in C<ExecStop> are only executed when the service
373             started successfully first. They are not invoked if the service was never started at all, or in case its
374             start-up failed, for example because any of the commands specified in C<ExecStart>,
375             C<ExecStartPre> or C<ExecStartPost> failed (and weren\'t prefixed with
376             C<->, see above) or timed out. Use C<ExecStopPost> to invoke commands when a
377             service failed to start up correctly and is shut down again. Also note that the stop operation is always
378             performed if the service started successfully, even if the processes in the service terminated on their
379             own or were killed. The stop commands must be prepared to deal with that case. C<$MAINPID>
380             will be unset if systemd knows that the main process exited by the time the stop commands are called.
381              
382             Service restart requests are implemented as stop operations followed by start operations. This
383             means that C<ExecStop> and C<ExecStopPost> are executed during a
384             service restart operation.
385              
386             It is recommended to use this setting for commands that communicate with the service requesting
387             clean termination. For post-mortem clean-up steps use C<ExecStopPost> instead.
388             ',
389             'type' => 'list'
390             },
391             'ExecStopPost',
392             {
393             'cargo' => {
394             'type' => 'leaf',
395             'value_type' => 'uniline'
396             },
397             'description' => "Additional commands that are executed after the service is stopped. This includes cases where
398             the commands configured in C<ExecStop> were used, where the service does not have any
399             C<ExecStop> defined, or where the service exited unexpectedly. This argument takes multiple
400             command lines, following the same scheme as described for C<ExecStart>. Use of these settings
401             is optional. Specifier and environment variable substitution is supported. Note that \x{2013} unlike
402             C<ExecStop> \x{2013} commands specified with this setting are invoked when a service failed to start
403             up correctly and is shut down again.
404              
405             It is recommended to use this setting for clean-up operations that shall be executed even when the
406             service failed to start up correctly. Commands configured with this setting need to be able to operate even if
407             the service failed starting up half-way and left incompletely initialized data around. As the service's
408             processes have been terminated already when the commands specified with this setting are executed they should
409             not attempt to communicate with them.
410              
411             Note that all commands that are configured with this setting are invoked with the result code of the
412             service, as well as the main process' exit code and status, set in the C<\$SERVICE_RESULT>,
413             C<\$EXIT_CODE> and C<\$EXIT_STATUS> environment variables, see
414             L<systemd.exec(5)> for
415             details.
416              
417             Note that the execution of C<ExecStopPost> is taken into account for the purpose of
418             C<Before>/C<After> ordering constraints.",
419             'type' => 'list'
420             },
421             'RestartSec',
422             {
423             'description' => 'Configures the time to sleep before restarting
424             a service (as configured with C<Restart>).
425             Takes a unit-less value in seconds, or a time span value such
426             as "5min 20s". Defaults to 100ms.',
427             'type' => 'leaf',
428             'value_type' => 'uniline'
429             },
430             'TimeoutStartSec',
431             {
432             'description' => "Configures the time to wait for start-up. If a daemon service does not signal start-up
433             completion within the configured time, the service will be considered failed and will be shut down again. The
434             precise action depends on the C<TimeoutStartFailureMode> option. Takes a unit-less value in
435             seconds, or a time span value such as \"5min 20s\". Pass C<infinity> to disable the timeout logic.
436             Defaults to C<DefaultTimeoutStartSec> from the manager configuration file, except when
437             C<Type=oneshot> is used, in which case the timeout is disabled by default (see
438             L<systemd-system.conf(5)>).
439              
440             If a service of C<Type=notify> sends C<EXTEND_TIMEOUT_USEC=\x{2026}>, this may cause
441             the start time to be extended beyond C<TimeoutStartSec>. The first receipt of this message
442             must occur before C<TimeoutStartSec> is exceeded, and once the start time has extended beyond
443             C<TimeoutStartSec>, the service manager will allow the service to continue to start, provided
444             the service repeats C<EXTEND_TIMEOUT_USEC=\x{2026}> within the interval specified until the service
445             startup status is finished by C<READY=1>. (see
446             L<sd_notify(3)>).
447             ",
448             'type' => 'leaf',
449             'value_type' => 'uniline'
450             },
451             'TimeoutStopSec',
452             {
453             'description' => "This option serves two purposes. First, it configures the time to wait for each
454             C<ExecStop> command. If any of them times out, subsequent C<ExecStop> commands
455             are skipped and the service will be terminated by C<SIGTERM>. If no C<ExecStop>
456             commands are specified, the service gets the C<SIGTERM> immediately. This default behavior
457             can be changed by the C<TimeoutStopFailureMode> option. Second, it configures the time
458             to wait for the service itself to stop. If it doesn't terminate in the specified time, it will be forcibly terminated
459             by C<SIGKILL> (see C<KillMode> in
460             L<systemd.kill(5)>).
461             Takes a unit-less value in seconds, or a time span value such
462             as \"5min 20s\". Pass C<infinity> to disable the
463             timeout logic. Defaults to
464             C<DefaultTimeoutStopSec> from the manager
465             configuration file (see
466             L<systemd-system.conf(5)>).
467              
468             If a service of C<Type=notify> sends C<EXTEND_TIMEOUT_USEC=\x{2026}>, this may cause
469             the stop time to be extended beyond C<TimeoutStopSec>. The first receipt of this message
470             must occur before C<TimeoutStopSec> is exceeded, and once the stop time has extended beyond
471             C<TimeoutStopSec>, the service manager will allow the service to continue to stop, provided
472             the service repeats C<EXTEND_TIMEOUT_USEC=\x{2026}> within the interval specified, or terminates itself
473             (see L<sd_notify(3)>).
474             ",
475             'type' => 'leaf',
476             'value_type' => 'uniline'
477             },
478             'TimeoutAbortSec',
479             {
480             'description' => "This option configures the time to wait for the service to terminate when it was aborted due to a
481             watchdog timeout (see C<WatchdogSec>). If the service has a short C<TimeoutStopSec>
482             this option can be used to give the system more time to write a core dump of the service. Upon expiration the service
483             will be forcibly terminated by C<SIGKILL> (see C<KillMode> in
484             L<systemd.kill(5)>). The core file will
485             be truncated in this case. Use C<TimeoutAbortSec> to set a sensible timeout for the core dumping per
486             service that is large enough to write all expected data while also being short enough to handle the service failure
487             in due time.
488              
489             Takes a unit-less value in seconds, or a time span value such as \"5min 20s\". Pass an empty value to skip
490             the dedicated watchdog abort timeout handling and fall back C<TimeoutStopSec>. Pass
491             C<infinity> to disable the timeout logic. Defaults to C<DefaultTimeoutAbortSec> from
492             the manager configuration file (see
493             L<systemd-system.conf(5)>).
494              
495             If a service of C<Type=notify> handles C<SIGABRT> itself (instead of relying
496             on the kernel to write a core dump) it can send C<EXTEND_TIMEOUT_USEC=\x{2026}> to
497             extended the abort time beyond C<TimeoutAbortSec>. The first receipt of this message
498             must occur before C<TimeoutAbortSec> is exceeded, and once the abort time has extended beyond
499             C<TimeoutAbortSec>, the service manager will allow the service to continue to abort, provided
500             the service repeats C<EXTEND_TIMEOUT_USEC=\x{2026}> within the interval specified, or terminates itself
501             (see L<sd_notify(3)>).
502             ",
503             'type' => 'leaf',
504             'value_type' => 'uniline'
505             },
506             'TimeoutSec',
507             {
508             'description' => 'A shorthand for configuring both
509             C<TimeoutStartSec> and
510             C<TimeoutStopSec> to the specified value.
511             ',
512             'type' => 'leaf',
513             'value_type' => 'uniline'
514             },
515             'TimeoutStartFailureMode',
516             {
517             'choice' => [
518             'terminate',
519             'abort',
520             'kill'
521             ],
522             'description' => 'These options configure the action that is taken in case a daemon service does not signal
523             start-up within its configured C<TimeoutStartSec>, respectively if it does not stop within
524             C<TimeoutStopSec>. Takes one of C<terminate>, C<abort> and
525             C<kill>. Both options default to C<terminate>.
526              
527             If C<terminate> is set the service will be gracefully terminated by sending the signal
528             specified in C<KillSignal> (defaults to C<SIGTERM>, see
529             L<systemd.kill(5)>). If the
530             service does not terminate the C<FinalKillSignal> is sent after
531             C<TimeoutStopSec>. If C<abort> is set, C<WatchdogSignal> is sent
532             instead and C<TimeoutAbortSec> applies before sending C<FinalKillSignal>.
533             This setting may be used to analyze services that fail to start-up or shut-down intermittently.
534             By using C<kill> the service is immediately terminated by sending
535             C<FinalKillSignal> without any further timeout. This setting can be used to expedite the
536             shutdown of failing services.
537             ',
538             'type' => 'leaf',
539             'value_type' => 'enum'
540             },
541             'TimeoutStopFailureMode',
542             {
543             'choice' => [
544             'terminate',
545             'abort',
546             'kill'
547             ],
548             'description' => 'These options configure the action that is taken in case a daemon service does not signal
549             start-up within its configured C<TimeoutStartSec>, respectively if it does not stop within
550             C<TimeoutStopSec>. Takes one of C<terminate>, C<abort> and
551             C<kill>. Both options default to C<terminate>.
552              
553             If C<terminate> is set the service will be gracefully terminated by sending the signal
554             specified in C<KillSignal> (defaults to C<SIGTERM>, see
555             L<systemd.kill(5)>). If the
556             service does not terminate the C<FinalKillSignal> is sent after
557             C<TimeoutStopSec>. If C<abort> is set, C<WatchdogSignal> is sent
558             instead and C<TimeoutAbortSec> applies before sending C<FinalKillSignal>.
559             This setting may be used to analyze services that fail to start-up or shut-down intermittently.
560             By using C<kill> the service is immediately terminated by sending
561             C<FinalKillSignal> without any further timeout. This setting can be used to expedite the
562             shutdown of failing services.
563             ',
564             'type' => 'leaf',
565             'value_type' => 'enum'
566             },
567             'RuntimeMaxSec',
568             {
569             'description' => "Configures a maximum time for the service to run. If this is used and the service has been
570             active for longer than the specified time it is terminated and put into a failure state. Note that this setting
571             does not have any effect on C<Type=oneshot> services, as they terminate immediately after
572             activation completed. Pass C<infinity> (the default) to configure no runtime
573             limit.
574              
575             If a service of C<Type=notify> sends C<EXTEND_TIMEOUT_USEC=\x{2026}>, this may cause
576             the runtime to be extended beyond C<RuntimeMaxSec>. The first receipt of this message
577             must occur before C<RuntimeMaxSec> is exceeded, and once the runtime has extended beyond
578             C<RuntimeMaxSec>, the service manager will allow the service to continue to run, provided
579             the service repeats C<EXTEND_TIMEOUT_USEC=\x{2026}> within the interval specified until the service
580             shutdown is achieved by C<STOPPING=1> (or termination). (see
581             L<sd_notify(3)>).
582             ",
583             'type' => 'leaf',
584             'value_type' => 'uniline'
585             },
586             'RuntimeRandomizedExtraSec',
587             {
588             'description' => 'This option modifies C<RuntimeMaxSec> by increasing the maximum runtime by an
589             evenly distributed duration between 0 and the specified value (in seconds). If C<RuntimeMaxSec> is
590             unspecified, then this feature will be disabled.
591             ',
592             'type' => 'leaf',
593             'value_type' => 'uniline'
594             },
595             'WatchdogSec',
596             {
597             'description' => 'Configures the watchdog timeout for a service.
598             The watchdog is activated when the start-up is completed. The
599             service must call
600             L<sd_notify(3)>
601             regularly with C<WATCHDOG=1> (i.e. the
602             "keep-alive ping"). If the time between two such calls is
603             larger than the configured time, then the service is placed in
604             a failed state and it will be terminated with
605             C<SIGABRT> (or the signal specified by
606             C<WatchdogSignal>). By setting
607             C<Restart> to C<on-failure>,
608             C<on-watchdog>, C<on-abnormal> or
609             C<always>, the service will be automatically
610             restarted. The time configured here will be passed to the
611             executed service process in the
612             C<WATCHDOG_USEC> environment variable. This
613             allows daemons to automatically enable the keep-alive pinging
614             logic if watchdog support is enabled for the service. If this
615             option is used, C<NotifyAccess> (see below)
616             should be set to open access to the notification socket
617             provided by systemd. If C<NotifyAccess> is
618             not set, it will be implicitly set to C<main>.
619             Defaults to 0, which disables this feature. The service can
620             check whether the service manager expects watchdog keep-alive
621             notifications. See
622             L<sd_watchdog_enabled(3)>
623             for details.
624             L<sd_event_set_watchdog(3)>
625             may be used to enable automatic watchdog notification support.
626             ',
627             'type' => 'leaf',
628             'value_type' => 'uniline'
629             },
630             'Restart',
631             {
632             'choice' => [
633             'no',
634             'on-success',
635             'on-failure',
636             'on-abnormal',
637             'on-watchdog',
638             'on-abort',
639             'always'
640             ],
641             'description' => 'Configures whether the service shall be
642             restarted when the service process exits, is killed, or a
643             timeout is reached. The service process may be the main
644             service process, but it may also be one of the processes
645             specified with C<ExecStartPre>,
646             C<ExecStartPost>,
647             C<ExecStop>,
648             C<ExecStopPost>, or
649             C<ExecReload>. When the death of the process
650             is a result of systemd operation (e.g. service stop or
651             restart), the service will not be restarted. Timeouts include
652             missing the watchdog "keep-alive ping" deadline and a service
653             start, reload, and stop operation timeouts.
654              
655             Takes one of
656             C<no>,
657             C<on-success>,
658             C<on-failure>,
659             C<on-abnormal>,
660             C<on-watchdog>,
661             C<on-abort>, or
662             C<always>.
663             If set to C<no> (the default), the service will
664             not be restarted. If set to C<on-success>, it
665             will be restarted only when the service process exits cleanly.
666             In this context, a clean exit means any of the following:
667             exit code of 0;for types other than
668             C<Type=oneshot>, one of the signals
669             C<SIGHUP>,
670             C<SIGINT>,
671             C<SIGTERM>, or
672             C<SIGPIPE>;exit statuses and signals specified in
673             C<SuccessExitStatus>.
674             If set to
675             C<on-failure>, the service will be restarted
676             when the process exits with a non-zero exit code, is
677             terminated by a signal (including on core dump, but excluding
678             the aforementioned four signals), when an operation (such as
679             service reload) times out, and when the configured watchdog
680             timeout is triggered. If set to C<on-abnormal>,
681             the service will be restarted when the process is terminated
682             by a signal (including on core dump, excluding the
683             aforementioned four signals), when an operation times out, or
684             when the watchdog timeout is triggered. If set to
685             C<on-abort>, the service will be restarted only
686             if the service process exits due to an uncaught signal not
687             specified as a clean exit status. If set to
688             C<on-watchdog>, the service will be restarted
689             only if the watchdog timeout for the service expires. If set
690             to C<always>, the service will be restarted
691             regardless of whether it exited cleanly or not, got terminated
692             abnormally by a signal, or hit a timeout.
693              
694             As exceptions to the setting above, the service will not
695             be restarted if the exit code or signal is specified in
696             C<RestartPreventExitStatus> (see below) or
697             the service is stopped with systemctl stop
698             or an equivalent operation. Also, the services will always be
699             restarted if the exit code or signal is specified in
700             C<RestartForceExitStatus> (see below).
701              
702             Note that service restart is subject to unit start rate
703             limiting configured with C<StartLimitIntervalSec>
704             and C<StartLimitBurst>, see
705             L<systemd.unit(5)>
706             for details. A restarted service enters the failed state only
707             after the start limits are reached.
708              
709             Setting this to C<on-failure> is the
710             recommended choice for long-running services, in order to
711             increase reliability by attempting automatic recovery from
712             errors. For services that shall be able to terminate on their
713             own choice (and avoid immediate restarting),
714             C<on-abnormal> is an alternative choice.',
715             'type' => 'leaf',
716             'value_type' => 'enum'
717             },
718             'SuccessExitStatus',
719             {
720             'description' => 'Takes a list of exit status definitions that, when returned by the main service
721             process, will be considered successful termination, in addition to the normal successful exit status
722             0 and, except for C<Type=oneshot>, the signals C<SIGHUP>, C<SIGINT>,
723             C<SIGTERM>, and C<SIGPIPE>. Exit status definitions can be
724             numeric termination statuses, termination status names, or termination signal names, separated by
725             spaces. See the Process Exit Codes section in
726             L<systemd.exec(5)> for
727             a list of termination status names (for this setting only the part without the
728             C<EXIT_> or C<EX_> prefix should be used). See L<signal(7)> for
729             a list of signal names.
730              
731             Note that this setting does not change the mapping between numeric exit statuses and their
732             names, i.e. regardless how this setting is used 0 will still be mapped to C<SUCCESS>
733             (and thus typically shown as C<0/SUCCESS> in tool outputs) and 1 to
734             C<FAILURE> (and thus typically shown as C<1/FAILURE>), and so on. It
735             only controls what happens as effect of these exit statuses, and how it propagates to the state of
736             the service as a whole.
737              
738             This option may appear more than once, in which case the list of successful exit statuses is
739             merged. If the empty string is assigned to this option, the list is reset, all prior assignments of
740             this option will have no effect.
741              
742             Note: systemd-analyze exit-status may be used to list exit statuses and
743             translate between numerical status values and names.',
744             'type' => 'leaf',
745             'value_type' => 'uniline'
746             },
747             'RestartPreventExitStatus',
748             {
749             'description' => "Takes a list of exit status definitions that, when returned by the main service
750             process, will prevent automatic service restarts, regardless of the restart setting configured with
751             C<Restart>. Exit status definitions can either be numeric exit codes or termination
752             signal names, and are separated by spaces. Defaults to the empty list, so that, by default, no exit
753             status is excluded from the configured restart logic. For example:
754              
755             RestartPreventExitStatus=1 6 SIGABRT
756              
757             ensures that exit codes 1 and 6 and the termination signal C<SIGABRT> will not
758             result in automatic service restarting. This option may appear more than once, in which case the list
759             of restart-preventing statuses is merged. If the empty string is assigned to this option, the list is
760             reset and all prior assignments of this option will have no effect.
761              
762             Note that this setting has no effect on processes configured via
763             C<ExecStartPre>, C<ExecStartPost>, C<ExecStop>,
764             C<ExecStopPost> or C<ExecReload>, but only on the main service
765             process, i.e. either the one invoked by C<ExecStart> or (depending on
766             C<Type>, C<PIDFile>, \x{2026}) the otherwise configured main
767             process.",
768             'type' => 'leaf',
769             'value_type' => 'uniline'
770             },
771             'RestartForceExitStatus',
772             {
773             'description' => 'Takes a list of exit status definitions that,
774             when returned by the main service process, will force automatic
775             service restarts, regardless of the restart setting configured
776             with C<Restart>. The argument format is
777             similar to
778             C<RestartPreventExitStatus>.',
779             'type' => 'leaf',
780             'value_type' => 'uniline'
781             },
782             'RootDirectoryStartOnly',
783             {
784             'description' => 'Takes a boolean argument. If true, the root
785             directory, as configured with the
786             C<RootDirectory> option (see
787             L<systemd.exec(5)>
788             for more information), is only applied to the process started
789             with C<ExecStart>, and not to the various
790             other C<ExecStartPre>,
791             C<ExecStartPost>,
792             C<ExecReload>, C<ExecStop>,
793             and C<ExecStopPost> commands. If false, the
794             setting is applied to all configured commands the same way.
795             Defaults to false.',
796             'type' => 'leaf',
797             'value_type' => 'boolean',
798             'write_as' => [
799             'no',
800             'yes'
801             ]
802             },
803             'NonBlocking',
804             {
805             'description' => 'Set the C<O_NONBLOCK> flag for all file descriptors passed via socket-based
806             activation. If true, all file descriptors >= 3 (i.e. all except stdin, stdout, stderr), excluding those passed
807             in via the file descriptor storage logic (see C<FileDescriptorStoreMax> for details), will
808             have the C<O_NONBLOCK> flag set and hence are in non-blocking mode. This option is only
809             useful in conjunction with a socket unit, as described in
810             L<systemd.socket(5)> and has no
811             effect on file descriptors which were previously saved in the file-descriptor store for example. Defaults to
812             false.',
813             'type' => 'leaf',
814             'value_type' => 'uniline'
815             },
816             'NotifyAccess',
817             {
818             'choice' => [
819             'none',
820             'main',
821             'exec',
822             'all'
823             ],
824             'description' => 'Controls access to the service status notification socket, as accessible via the
825             L<sd_notify(3)> call. Takes one
826             of C<none> (the default), C<main>, C<exec> or
827             C<all>. If C<none>, no daemon status updates are accepted from the service
828             processes, all status update messages are ignored. If C<main>, only service updates sent from the
829             main process of the service are accepted. If C<exec>, only service updates sent from any of the
830             main or control processes originating from one of the C<Exec*=> commands are accepted. If
831             C<all>, all services updates from all members of the service\'s control group are accepted. This
832             option should be set to open access to the notification socket when using C<Type=notify> or
833             C<WatchdogSec> (see above). If those options are used but C<NotifyAccess> is
834             not configured, it will be implicitly set to C<main>.
835              
836             Note that sd_notify() notifications may be attributed to units correctly only if
837             either the sending process is still around at the time PID 1 processes the message, or if the sending process
838             is explicitly runtime-tracked by the service manager. The latter is the case if the service manager originally
839             forked off the process, i.e. on all processes that match C<main> or
840             C<exec>. Conversely, if an auxiliary process of the unit sends an
841             sd_notify() message and immediately exits, the service manager might not be able to
842             properly attribute the message to the unit, and thus will ignore it, even if
843             C<NotifyAccess>C<all> is set for it.
844              
845             Hence, to eliminate all race conditions involving lookup of the client\'s unit and attribution of notifications
846             to units correctly, sd_notify_barrier() may be used. This call acts as a synchronization point
847             and ensures all notifications sent before this call have been picked up by the service manager when it returns
848             successfully. Use of sd_notify_barrier() is needed for clients which are not invoked by the
849             service manager, otherwise this synchronization mechanism is unnecessary for attribution of notifications to the
850             unit.',
851             'type' => 'leaf',
852             'value_type' => 'enum'
853             },
854             'Sockets',
855             {
856             'description' => 'Specifies the name of the socket units this
857             service shall inherit socket file descriptors from when the
858             service is started. Normally, it should not be necessary to use
859             this setting, as all socket file descriptors whose unit shares
860             the same name as the service (subject to the different unit
861             name suffix of course) are passed to the spawned
862             process.
863              
864             Note that the same socket file descriptors may be passed
865             to multiple processes simultaneously. Also note that a
866             different service may be activated on incoming socket traffic
867             than the one which is ultimately configured to inherit the
868             socket file descriptors. Or, in other words: the
869             C<Service> setting of
870             C<.socket> units does not have to match the
871             inverse of the C<Sockets> setting of the
872             C<.service> it refers to.
873              
874             This option may appear more than once, in which case the list of socket units is merged. Note
875             that once set, clearing the list of sockets again (for example, by assigning the empty string to this
876             option) is not supported.',
877             'type' => 'leaf',
878             'value_type' => 'uniline'
879             },
880             'FileDescriptorStoreMax',
881             {
882             'description' => 'Configure how many file descriptors may be stored in the service manager for the
883             service using
884             L<sd_pid_notify_with_fds(3)>\'s
885             C<FDSTORE=1> messages. This is useful for implementing services that can restart
886             after an explicit request or a crash without losing state. Any open sockets and other file
887             descriptors which should not be closed during the restart may be stored this way. Application state
888             can either be serialized to a file in C</run/>, or better, stored in a
889             L<memfd_create(2)>
890             memory file descriptor. Defaults to 0, i.e. no file descriptors may be stored in the service
891             manager. All file descriptors passed to the service manager from a specific service are passed back
892             to the service\'s main process on the next service restart (see
893             L<sd_listen_fds(3)> for
894             details about the precise protocol used and the order in which the file descriptors are passed). Any
895             file descriptors passed to the service manager are automatically closed when
896             C<POLLHUP> or C<POLLERR> is seen on them, or when the service is
897             fully stopped and no job is queued or being executed for it. If this option is used,
898             C<NotifyAccess> (see above) should be set to open access to the notification socket
899             provided by systemd. If C<NotifyAccess> is not set, it will be implicitly set to
900             C<main>.',
901             'type' => 'leaf',
902             'value_type' => 'uniline'
903             },
904             'USBFunctionDescriptors',
905             {
906             'description' => 'Configure the location of a file containing
907             L<USB
908             FunctionFS|https://docs.kernel.org/usb/functionfs.html> descriptors, for implementation of USB
909             gadget functions. This is used only in conjunction with a
910             socket unit with C<ListenUSBFunction>
911             configured. The contents of this file are written to the
912             C<ep0> file after it is
913             opened.',
914             'type' => 'leaf',
915             'value_type' => 'uniline'
916             },
917             'USBFunctionStrings',
918             {
919             'description' => 'Configure the location of a file containing
920             USB FunctionFS strings. Behavior is similar to
921             C<USBFunctionDescriptors>
922             above.',
923             'type' => 'leaf',
924             'value_type' => 'uniline'
925             },
926             'OOMPolicy',
927             {
928             'description' => 'Configure the out-of-memory (OOM) kernel killer policy. Note that the userspace OOM
929             killer
930             L<systemd-oomd.service(8)>
931             is a more flexible solution that aims to prevent out-of-memory situations for the userspace, not just
932             the kernel.
933              
934             On Linux, when memory becomes scarce to the point that the kernel has trouble allocating memory
935             for itself, it might decide to kill a running process in order to free up memory and reduce memory
936             pressure. This setting takes one of C<continue>, C<stop> or
937             C<kill>. If set to C<continue> and a process of the service is
938             killed by the kernel\'s OOM killer this is logged but the service continues running. If set to
939             C<stop> the event is logged but the service is terminated cleanly by the service
940             manager. If set to C<kill> and one of the service\'s processes is killed by the OOM
941             killer the kernel is instructed to kill all remaining processes of the service too, by setting the
942             C<memory.oom.group> attribute to C<1>; also see L<kernel
943             documentation|https://docs.kernel.org/admin-guide/cgroup-v2.html>.
944              
945             Defaults to the setting C<DefaultOOMPolicy> in
946             L<systemd-system.conf(5)>
947             is set to, except for services where C<Delegate> is turned on, where it defaults to
948             C<continue>.
949              
950             Use the C<OOMScoreAdjust> setting to configure whether processes of the unit
951             shall be considered preferred or less preferred candidates for process termination by the Linux OOM
952             killer logic. See
953             L<systemd.exec(5)> for
954             details.
955              
956             This setting also applies to systemd-oomd. Similarly to the kernel OOM
957             kills, this setting determines the state of the service after systemd-oomd kills a
958             cgroup associated with the service.',
959             'type' => 'leaf',
960             'value_type' => 'uniline'
961             },
962             'FailureAction',
963             {
964             'status' => 'deprecated',
965             'type' => 'leaf',
966             'value_type' => 'uniline',
967             'warn' => 'FailureAction is now part of Unit.'
968             },
969             'SuccessAction',
970             {
971             'status' => 'deprecated',
972             'type' => 'leaf',
973             'value_type' => 'uniline',
974             'warn' => 'SuccessAction is now part of Unit.'
975             },
976             'StartLimitBurst',
977             {
978             'status' => 'deprecated',
979             'type' => 'leaf',
980             'value_type' => 'uniline',
981             'warn' => 'StartLimitBurst is now part of Unit.'
982             },
983             'StartLimitInterval',
984             {
985             'status' => 'deprecated',
986             'type' => 'leaf',
987             'value_type' => 'uniline',
988             'warn' => 'service/StartLimitInterval is now Unit/StartLimitIntervalSec.'
989             },
990             'RebootArgument',
991             {
992             'status' => 'deprecated',
993             'type' => 'leaf',
994             'value_type' => 'uniline',
995             'warn' => 'RebootArgument is now part of Unit.'
996             }
997             ],
998             'generated_by' => 'parse-man.pl from systemd doc',
999             'include' => [
1000             'Systemd::Common::ResourceControl',
1001             'Systemd::Common::Exec',
1002             'Systemd::Common::Kill'
1003             ],
1004             'license' => 'LGPLv2.1+',
1005             'name' => 'Systemd::Section::Service'
1006             }
1007             ]
1008             ;
1009