]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Allow timers to trigger timers (#8043)
authorBoucman <jeremy.rosen@enst-bretagne.fr>
Wed, 14 Feb 2018 13:10:07 +0000 (14:10 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 14 Feb 2018 13:10:07 +0000 (14:10 +0100)
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

index 00408c4b843c9139c31af2e70aeb04a5ae98c336..4c520b86697485a4c0fd08cb8f882c33f7915325 100644 (file)
@@ -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;
         }