From 49219a1c03641c3cb62adc059a6fa59cfc7f168b Mon Sep 17 00:00:00 2001 From: Boucman Date: Wed, 14 Feb 2018 14:10:07 +0100 Subject: [PATCH] Allow timers to trigger timers (#8043) Unlike any other unit type, it makes sense for a timer to start another timer. It is an easy way to crate logical "and" between time conditions for instance, every day but no less than 5' after boot can easily be implemented by a OnBootSec triggering an OnCalendar. This is particulary usefull with Persistant timers which tend to all fire together at startup --- src/core/load-fragment.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 00408c4b843..4c520b86697 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -1745,9 +1745,8 @@ int config_parse_trigger_unit( log_syntax(unit, LOG_ERR, filename, line, 0, "Unit type not valid, ignoring: %s", rvalue); return 0; } - - if (type == u->type) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Trigger cannot be of same type, ignoring: %s", rvalue); + if (unit_has_name(u, p)) { + log_syntax(unit, LOG_ERR, filename, line, 0, "Units cannot trigger themselves, ignoring: %s", rvalue); return 0; }