#include "unit-name.h"
#include "timer.h"
#include "dbus-timer.h"
+#include "special.h"
static const UnitActiveState state_translation_table[_TIMER_STATE_MAX] = {
[TIMER_DEAD] = UNIT_INACTIVE,
[TIMER_WAITING] = UNIT_ACTIVE,
[TIMER_RUNNING] = UNIT_ACTIVE,
[TIMER_ELAPSED] = UNIT_ACTIVE,
- [TIMER_MAINTENANCE] = UNIT_INACTIVE_MAINTENANCE
+ [TIMER_MAINTENANCE] = UNIT_MAINTENANCE
};
static void timer_init(Unit *u) {
if ((r = unit_add_dependency(u, UNIT_BEFORE, t->unit, true)) < 0)
return r;
+
+ /* Timers shouldn't stay around on shutdown */
+ if (t->meta.default_dependencies)
+ if ((r = unit_add_two_dependencies_by_name(u, UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true)) < 0)
+ return r;
}
return timer_verify(t);