mirror of
https://github.com/9001/copyparty.git
synced 2026-06-18 20:22:27 -06:00
sd_notify only when set
This commit is contained in:
parent
8c201b844e
commit
9b0268970c
|
|
@ -985,7 +985,9 @@ class SvcHub(object):
|
||||||
def after_httpsrv_up(self) -> None:
|
def after_httpsrv_up(self) -> None:
|
||||||
self.up2k.init_vols()
|
self.up2k.init_vols()
|
||||||
|
|
||||||
Daemon(self.sd_notify, "sd-notify")
|
zb = os.environ.get("NOTIFY_SOCKET")
|
||||||
|
if zb:
|
||||||
|
Daemon(self.sd_notify, "sd-notify", (zb,))
|
||||||
|
|
||||||
zb = os.environ.get("S6_NOTIFY_FD")
|
zb = os.environ.get("S6_NOTIFY_FD")
|
||||||
if zb:
|
if zb:
|
||||||
|
|
@ -1882,12 +1884,8 @@ class SvcHub(object):
|
||||||
self.log("svchub", "cannot efficiently use multiple CPU cores")
|
self.log("svchub", "cannot efficiently use multiple CPU cores")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def sd_notify(self) -> None:
|
def sd_notify(self, zb: bytes) -> None:
|
||||||
try:
|
try:
|
||||||
zb = os.environ.get("NOTIFY_SOCKET")
|
|
||||||
if not zb:
|
|
||||||
return
|
|
||||||
|
|
||||||
addr = unicode(zb)
|
addr = unicode(zb)
|
||||||
if addr.startswith("@"):
|
if addr.startswith("@"):
|
||||||
addr = "\0" + addr[1:]
|
addr = "\0" + addr[1:]
|
||||||
|
|
@ -1899,7 +1897,8 @@ class SvcHub(object):
|
||||||
sck.connect(addr)
|
sck.connect(addr)
|
||||||
sck.sendall(b"READY=1")
|
sck.sendall(b"READY=1")
|
||||||
except:
|
except:
|
||||||
self.log("sd_notify", min_ex())
|
t = "NOTIFY_SOCKET=%s:\n%s"
|
||||||
|
self.log("sd-notify", t % (zb, min_ex()), 1)
|
||||||
|
|
||||||
def s6_notify(self, zb: bytes) -> None:
|
def s6_notify(self, zb: bytes) -> None:
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue