From 8c201b844ee71b4ab0271aa0be90986e8de98ea6 Mon Sep 17 00:00:00 2001 From: Mobin Date: Fri, 22 May 2026 20:56:47 +0330 Subject: [PATCH] s6-notify: support fd-based s6 notification protocol (#1466) Dinit and s6 supervision suite are known to support this protocol. See https://skarnet.org/software/s6/notifywhenup.html and https://davmac.org/projects/dinit/man-pages-html/dinit-service.5.html#ready Signed-off-by: Mobin Aydinfar --- copyparty/svchub.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/copyparty/svchub.py b/copyparty/svchub.py index fc0a9db9..1e74321d 100644 --- a/copyparty/svchub.py +++ b/copyparty/svchub.py @@ -987,6 +987,10 @@ class SvcHub(object): Daemon(self.sd_notify, "sd-notify") + zb = os.environ.get("S6_NOTIFY_FD") + if zb: + Daemon(self.s6_notify, "s6-notify", (zb,)) + def _feature_test(self) -> None: fok = [] fng = [] @@ -1897,6 +1901,17 @@ class SvcHub(object): except: self.log("sd_notify", min_ex()) + def s6_notify(self, zb: bytes) -> None: + try: + fd = int(zb) + if fd < 3: + raise Exception("value < 3") + os.write(fd, b"\n") + os.close(fd) + except: + t = "S6_NOTIFY_FD=%s:\n%s" + self.log("s6-notify", t % (zb, min_ex()), 1) + def log_stacks(self) -> None: td = time.time() - self.tstack if td < 300: