Hi, [email protected] schrob: > On Sun, Mar 2, 2025, at 3:10 AM, Jan Braun wrote: > > just setting up the notification-fd. > > I'm not sure how to do this, since the sd-notify protocol[1] doesn't > inherit an fd; instead it looks at env var NOTIFY_SOCKET to read a > path to a unix socket, which the ready service opens and uses to send > datagrams.
Dang, that's what I get for not testing things; I was misremembering
that it was an inherited fd. Sorry :(
> If there's a way to connect a unix datagram socket to the
> notification-fd provided by s6 more directly than I've done here, I'd
> love to know how!
Not really. But I prefer doing things in shell when I can get away with
it, so here's a ./run script to use with ./notification-fd 3:
| #!/bin/sh
| set -eu
|
| NOTIFY_SOCKET=`realpath ./notify`
| export NOTIFY_SOCKET
| timeout 1234 socat "unix-recvfrom:$NOTIFY_SOCKET,unlink-early" "system:paste
>&3" &
|
| # fake service:
| exec python3 -c "import systemd.daemon, time;
systemd.daemon.notify('READY=1'); time.sleep(10)"
The paste(1) is there to actually create the newline. While sd_notify(3)
says "A trailing newline is implied if none is specified", python
doesn't produce one. So much for cleverly reusing that. Yay.
regards,
Jan
signature.asc
Description: PGP signature
