diff options
author | Michael Chapman <mike@very.puzzling.org> | 2014-11-06 19:47:02 +1100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-11-06 20:28:42 -0500 |
commit | bfb4c47dddd3c7aeaa07eb733bb50b62eff2e082 (patch) | |
tree | b2cb0911060d323638223d6e3812be05cb593015 | |
parent | e47a9f972749544d28cffede77de13e9d8af4d2b (diff) |
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 779042e772d2459f7649b34a164902dc456f1bab)
-rw-r--r-- | src/core/timer.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/timer.c b/src/core/timer.c index a3713e214..5c4e9f995 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -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; |