mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 08:56:15 +09:00
core/service: introduce sd_notify() RESTART_RESET=1 for resetting restart counter (#36698)
This commit is contained in:
3
TODO
3
TODO
@@ -2850,3 +2850,6 @@ Features:
|
||||
* shared/wall: Once more programs are taught to prefer sd-login over utmp,
|
||||
switch the default wall implementation to wall_logind
|
||||
(https://github.com/systemd/systemd/pull/29051#issuecomment-1704917074)
|
||||
|
||||
* Hook up systemd-journal-upload with RESTART_RESET=1 logic (should probably
|
||||
be conditioned on the num of successfully uploaded entries?)
|
||||
|
||||
@@ -333,7 +333,7 @@
|
||||
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
||||
for information how to enable this functionality and
|
||||
<citerefentry><refentrytitle>sd_watchdog_enabled</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||
for the details of how the service can check whether the watchdog is enabled. </para></listitem>
|
||||
for the details of how the service can check whether the watchdog is enabled.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
@@ -345,7 +345,7 @@
|
||||
in time. Note that <varname>WatchdogSec=</varname> does not need to be enabled for
|
||||
<literal>WATCHDOG=trigger</literal> to trigger the watchdog action. See
|
||||
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
||||
for information about the watchdog behavior. </para>
|
||||
for information about the watchdog behavior.</para>
|
||||
|
||||
<xi:include href="version-info.xml" xpointer="v243"/></listitem>
|
||||
</varlistentry>
|
||||
@@ -376,6 +376,18 @@
|
||||
<xi:include href="version-info.xml" xpointer="v236"/></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>RESTART_RESET=1</term>
|
||||
|
||||
<listitem><para>Reset the restart counter of the service, which has the effect of restoring
|
||||
the restart duration to <varname>RestartSec=</varname> if <varname>RestartSteps=</varname> and
|
||||
<varname>RestartMaxDelaySec=</varname> are in use. For more information, refer to
|
||||
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
|
||||
</para>
|
||||
|
||||
<xi:include href="version-info.xml" xpointer="v258"/></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>FDSTORE=1</term>
|
||||
|
||||
|
||||
@@ -4861,6 +4861,17 @@ static void service_notify_message(
|
||||
service_override_watchdog_timeout(s, watchdog_override_usec);
|
||||
}
|
||||
|
||||
/* Interpret RESTART_RESET=1 */
|
||||
if (strv_contains(tags, "RESTART_RESET=1") && IN_SET(s->state, SERVICE_RUNNING, SERVICE_STOP)) {
|
||||
log_unit_struct(u, LOG_NOTICE,
|
||||
LOG_UNIT_MESSAGE(u, "Got RESTART_RESET=1, resetting restart counter from %u.", s->n_restarts),
|
||||
"N_RESTARTS=0",
|
||||
LOG_UNIT_INVOCATION_ID(u));
|
||||
|
||||
s->n_restarts = 0;
|
||||
notify_dbus = true;
|
||||
}
|
||||
|
||||
/* Process FD store messages. Either FDSTOREREMOVE=1 for removal, or FDSTORE=1 for addition. In both cases,
|
||||
* process FDNAME= for picking the file descriptor name to use. Note that FDNAME= is required when removing
|
||||
* fds, but optional when pushing in new fds, for compatibility reasons. */
|
||||
@@ -5131,8 +5142,6 @@ static void service_reset_failed(Unit *u) {
|
||||
s->live_mount_result = SERVICE_SUCCESS;
|
||||
s->clean_result = SERVICE_SUCCESS;
|
||||
s->n_restarts = 0;
|
||||
|
||||
(void) unit_set_debug_invocation(u, /* enable= */ false);
|
||||
}
|
||||
|
||||
static PidRef* service_main_pid(Unit *u, bool *ret_is_alien) {
|
||||
|
||||
@@ -3867,7 +3867,8 @@ void unit_reset_failed(Unit *u) {
|
||||
|
||||
ratelimit_reset(&u->start_ratelimit);
|
||||
u->start_limit_hit = false;
|
||||
u->debug_invocation = false;
|
||||
|
||||
(void) unit_set_debug_invocation(u, /* enable= */ false);
|
||||
}
|
||||
|
||||
Unit *unit_following(Unit *u) {
|
||||
|
||||
Reference in New Issue
Block a user