mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-09-27 08:30:09 +00:00
timer: reenable TIMER_ACTIVE timers when restarted
A timer configured with OnActiveSec will start its associated unit again
if the timer is stopped, then started. However, if the timer unit is
restarted -- with "systemctl restart", say -- this does not occur.
This commit ensures that TIMER_ACTIVE timers are re-enabled whenever the
timer is started, even if that's within a restart job.
(cherry picked from commit 779042e772)
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
5c10861b9e
commit
7879d2f09c
@@ -521,6 +521,7 @@ fail:
|
||||
|
||||
static int timer_start(Unit *u) {
|
||||
Timer *t = TIMER(u);
|
||||
TimerValue *v;
|
||||
|
||||
assert(t);
|
||||
assert(t->state == TIMER_DEAD || t->state == TIMER_FAILED);
|
||||
@@ -530,6 +531,11 @@ static int timer_start(Unit *u) {
|
||||
|
||||
t->last_trigger = DUAL_TIMESTAMP_NULL;
|
||||
|
||||
/* Reenable all timers that depend on unit activation time */
|
||||
LIST_FOREACH(value, v, t->values)
|
||||
if (v->base == TIMER_ACTIVE)
|
||||
v->disabled = false;
|
||||
|
||||
if (t->stamp_path) {
|
||||
struct stat st;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user