]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hostnamed: use Type=notify
authorMike Yuan <me@yhndnzj.com>
Tue, 9 Jan 2024 11:53:18 +0000 (19:53 +0800)
committerMike Yuan <me@yhndnzj.com>
Tue, 9 Jan 2024 13:57:46 +0000 (21:57 +0800)
src/hostname/hostnamed.c
units/systemd-hostnamed.service.in

index f01d771f9bc1e28adcf182d2bcd7ac9902dadcfb..0e06a16a24198a1d7f5234a004319d3992df8bda 100644 (file)
@@ -14,6 +14,7 @@
 #include "bus-log-control-api.h"
 #include "bus-polkit.h"
 #include "constants.h"
+#include "daemon-util.h"
 #include "env-file-label.h"
 #include "env-file.h"
 #include "env-util.h"
@@ -1733,6 +1734,10 @@ static int run(int argc, char *argv[]) {
         if (r < 0)
                 return r;
 
+        r = sd_notify(false, NOTIFY_READY);
+        if (r < 0)
+                log_warning_errno(r, "Failed to send readiness notification, ignoring: %m");
+
         r = bus_event_loop_with_idle(
                         context.event,
                         context.bus,
index 1cc15dd7cfd21cd0515e2ee2394b2d7f2f61fdb0..ab00c24b53b27554ef23c95b643fbf1989e29f39 100644 (file)
@@ -15,6 +15,7 @@ Documentation=man:machine-info(5)
 Documentation=man:org.freedesktop.hostname1(5)
 
 [Service]
+Type=notify
 BusName=org.freedesktop.hostname1
 CapabilityBoundingSet=CAP_SYS_ADMIN
 ExecStart={{LIBEXECDIR}}/systemd-hostnamed