[RFC PATCH 3/6] Notify systemd when ready and stopping
Victor Westerhuis
victor@westerhu.is
Sun Mar 7 12:49:55 GMT 2021
Signed-off-by: Victor Westerhuis <victor@westerhu.is>
---
config/debuginfod.service | 1 +
debuginfod/debuginfod.cxx | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/config/debuginfod.service b/config/debuginfod.service
index b64d8cb9..6c434705 100644
--- a/config/debuginfod.service
+++ b/config/debuginfod.service
@@ -4,6 +4,7 @@ Documentation=http://elfutils.org/
After=network.target
[Service]
+Type=Notify
EnvironmentFile=/etc/sysconfig/debuginfod
User=debuginfod
Group=debuginfod
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index caced48c..4dece371 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -3576,11 +3576,17 @@ main (int argc, char *argv[])
}
/* Trivial main loop! */
+#ifdef ENABLE_SYSTEMD
+ (void) sd_notify (false, "READY=1");
+#endif
set_metric("ready", 1);
while (! interrupted)
pause ();
scanq.nuke(); // wake up any remaining scanq-related threads, let them die
set_metric("ready", 0);
+#ifdef ENABLE_SYSTEMD
+ (void) sd_notify (false, "STOPPING=1");
+#endif
if (verbose)
obatched(clog) << "stopping" << endl;
--
2.30.1
More information about the Elfutils-devel
mailing list