| 1 | # | ||
| 2 | # This file is part of Config-Model-Systemd | ||
| 3 | # | ||
| 4 | # This software is Copyright (c) 2008-2026 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 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 1 | ▶ | use v5.20; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 1 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | return [ | ||
| 16 | { | ||
| 17 | 1 | 'accept' => [ | |
| 18 | '.*', | ||
| 19 | { | ||
| 20 | 'type' => 'leaf', | ||
| 21 | 'value_type' => 'uniline', | ||
| 22 | 'warn' => '$unknown_param_msg' | ||
| 23 | } | ||
| 24 | ], | ||
| 25 | 'description' => { | ||
| 26 | 'FailureAction' => "Configure the action to take when the unit stops and enters a failed state or | ||
| 27 | inactive state. Takes one of C<none>, C<reboot>, | ||
| 28 | C<reboot-force>, C<reboot-immediate>, C<poweroff>, | ||
| 29 | C<poweroff-force>, C<poweroff-immediate>, C<exit>, | ||
| 30 | C<exit-force>, C<soft-reboot>, C<soft-reboot-force>, | ||
| 31 | C<kexec>, C<kexec-force>, C<halt>, | ||
| 32 | C<halt-force> and C<halt-immediate>. In system mode, all options are | ||
| 33 | allowed. In user mode, only C<none>, C<exit>, and | ||
| 34 | C<exit-force> are allowed. Both options default to C<none>. | ||
| 35 | |||
| 36 | These actions are tied to the unit's state transitions and fire only when the unit actually | ||
| 37 | transitions out of an C<active> or C<activating> state. As a | ||
| 38 | consequence, C<Condition\x{2026}=> and C<Assert\x{2026}=> directives that fail do | ||
| 39 | not trigger C<SuccessAction> or | ||
| 40 | C<FailureAction>: they prevent activation in the first place, so no state transition | ||
| 41 | occurs. By contrast, the C<ExecCondition> directive in | ||
| 42 | L<systemd.service(5)> | ||
| 43 | runs as part of activation, so an C<ExecCondition> skip will | ||
| 44 | trigger C<SuccessAction>. | ||
| 45 | |||
| 46 | If C<none> is set, no action will be triggered. C<reboot> causes a | ||
| 47 | reboot following the normal shutdown procedure (i.e. equivalent to systemctl | ||
| 48 | reboot). C<reboot-force> causes a forced reboot which will terminate all | ||
| 49 | processes forcibly but should cause no dirty file systems on reboot (i.e. equivalent to | ||
| 50 | systemctl reboot -f) and C<reboot-immediate> causes immediate | ||
| 51 | execution of the | ||
| 52 | L<reboot(2)> system | ||
| 53 | call, which might result in data loss (i.e. equivalent to systemctl reboot -ff). | ||
| 54 | Similarly, C<poweroff>, C<poweroff-force>, | ||
| 55 | C<poweroff-immediate>, C<kexec>, C<kexec-force>, | ||
| 56 | C<halt>, C<halt-force> and C<halt-immediate> have the | ||
| 57 | effect of powering down the system, executing kexec, and halting the system respectively with similar | ||
| 58 | semantics. C<exit> causes the manager to exit following the normal shutdown procedure, | ||
| 59 | and C<exit-force> causes it terminate without shutting down services. When | ||
| 60 | C<exit> or C<exit-force> is used by default the exit status of the main | ||
| 61 | process of the unit (if this applies) is returned from the service manager. However, this may be | ||
| 62 | overridden with | ||
| 63 | C<FailureActionExitStatus>/C<SuccessActionExitStatus>, see below. | ||
| 64 | C<soft-reboot> will trigger a userspace reboot operation. | ||
| 65 | C<soft-reboot-force> does that too, but does not go through the shutdown transaction | ||
| 66 | beforehand.", | ||
| 67 | 'RebootArgument' => 'Configure the optional argument for the | ||
| 68 | L<reboot(2)> system call if | ||
| 69 | C<StartLimitAction> or C<FailureAction> is a reboot action. This | ||
| 70 | works just like the optional argument to systemctl reboot command.', | ||
| 71 | 'StartLimitBurst' => 'Configure unit start rate limiting. Units which are started more than | ||
| 72 | burst times within an interval time span are | ||
| 73 | not permitted to start any more. Use C<StartLimitIntervalSec> to configure the | ||
| 74 | checking interval and C<StartLimitBurst> to configure how many starts per interval | ||
| 75 | are allowed. | ||
| 76 | |||
| 77 | interval is a time span with the default unit of seconds, but other | ||
| 78 | units may be specified, see | ||
| 79 | L<systemd.time(7)>. | ||
| 80 | The special value C<infinity> can be used to limit the total number of start | ||
| 81 | attempts, even if they happen at large time intervals. | ||
| 82 | Defaults to C<DefaultStartLimitIntervalSec> in manager configuration file, and may | ||
| 83 | be set to 0 to disable any kind of rate limiting. burst is a number and | ||
| 84 | defaults to C<DefaultStartLimitBurst> in manager configuration file. | ||
| 85 | |||
| 86 | These configuration options are particularly useful in conjunction with the service setting | ||
| 87 | C<Restart> (see | ||
| 88 | L<systemd.service(5)>); | ||
| 89 | however, they apply to all kinds of starts (including manual), not just those triggered by the | ||
| 90 | C<Restart> logic. | ||
| 91 | |||
| 92 | Note that units which are configured for C<Restart>, and which reach the start | ||
| 93 | limit are not attempted to be restarted anymore; however, they may still be restarted manually or | ||
| 94 | from a timer or socket at a later point, after the interval has passed. | ||
| 95 | From that point on, the restart logic is activated again. systemctl reset-failed | ||
| 96 | will cause the restart rate counter for a service to be flushed, which is useful if the administrator | ||
| 97 | wants to manually start a unit and the start limit interferes with that. Rate-limiting is enforced | ||
| 98 | after any unit condition checks are executed, and hence unit activations with failing conditions do | ||
| 99 | not count towards the rate limit. | ||
| 100 | |||
| 101 | When a unit is unloaded due to the garbage collection logic (see above) its rate limit counters | ||
| 102 | are flushed out too. This means that configuring start rate limiting for a unit that is not | ||
| 103 | referenced continuously has no effect. | ||
| 104 | |||
| 105 | This setting does not apply to slice, target, device, and scope units, since they are unit | ||
| 106 | types whose activation may either never fail, or may succeed only a single time.', | ||
| 107 | 'StartLimitIntervalSec' => '*StartLimitBurst', | ||
| 108 | 'SuccessAction' => '*FailureAction' | ||
| 109 | }, | ||
| 110 | 'element' => [ | ||
| 111 | 'FailureAction', | ||
| 112 | { | ||
| 113 | 'choice' => [ | ||
| 114 | 'exit', | ||
| 115 | 'exit-force', | ||
| 116 | 'halt', | ||
| 117 | 'halt-force', | ||
| 118 | 'halt-immediate', | ||
| 119 | 'kexec', | ||
| 120 | 'kexec-force', | ||
| 121 | 'none', | ||
| 122 | 'poweroff', | ||
| 123 | 'poweroff-force', | ||
| 124 | 'poweroff-immediate', | ||
| 125 | 'reboot', | ||
| 126 | 'reboot-force', | ||
| 127 | 'reboot-immediate', | ||
| 128 | 'soft-reboot', | ||
| 129 | 'soft-reboot-force' | ||
| 130 | ], | ||
| 131 | 'type' => 'leaf', | ||
| 132 | 'value_type' => 'enum' | ||
| 133 | }, | ||
| 134 | 'SuccessAction', | ||
| 135 | '*FailureAction', | ||
| 136 | 'StartLimitBurst', | ||
| 137 | { | ||
| 138 | 'type' => 'leaf', | ||
| 139 | 'value_type' => 'uniline' | ||
| 140 | }, | ||
| 141 | 'StartLimitIntervalSec', | ||
| 142 | '*StartLimitBurst', | ||
| 143 | 'RebootArgument', | ||
| 144 | '*StartLimitBurst' | ||
| 145 | ], | ||
| 146 | 'include' => [ | ||
| 147 | 'Systemd::Section::Unit' | ||
| 148 | ], | ||
| 149 | 'name' => 'Systemd::Section::TimerUnit' | ||
| 150 | } | ||
| 151 | ] | ||
| 152 | ; | ||