]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
busctl: send READY=1 when we become a monitor
authorFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 8 Nov 2023 22:57:27 +0000 (23:57 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 8 Nov 2023 22:57:27 +0000 (23:57 +0100)
This is pretty much the same stuff as `resolvectl monitor` does, and
allows us to run `busctl monitor` in a Type=notify unit which ensures
that `busctl` is really listening for messages once the unit is marked
as started.

src/busctl/busctl.c

index d13d5bef6d9d4c1280a075e72aadf7b40e9b6679..9f82198f2f1389cc8d1480940e2ecb8656f7db94 100644 (file)
@@ -1311,6 +1311,8 @@ static int monitor(int argc, char **argv, int (*dump)(sd_bus_message *m, FILE *f
         if (!arg_quiet && arg_json_format_flags == JSON_FORMAT_OFF)
                 log_info("Monitoring bus message stream.");
 
+        (void) sd_notify(/* unset_environment=false */ false, "READY=1");
+
         for (;;) {
                 _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;