On 28/07/2015 16:59, Patrick Mahoney wrote:
If I understand correctly, any 'readiness' reporting mechanism must originate from the run script (to inherit notification-fd).
Yes.
Do you have any suggestions for adding readiness support to a daemon *without modifying that daemon*?
It's still possible, and exactly as hackish as before. :)
Previously, I had been using s6-log to match a particular line from the daemon's log output (e.g. "$service is ready"), sending the matched line to something like 'cd .. s6-notifywhenup echo' (note: a child process of run/log, not run).
Yes, I remember that case.
To support the same through the notification-fd, I can imagine a rough scheme such as: in run: background { if { s6-ftrig-wait fifodir U } fdmove 1 3 echo } ... run the daemon in log/run pipeline -w { forstdin -d"\n" i s6-ftrig-noitfy ../fifodir U } s6-log - +"daemon is ready" 1 + t n20 !"gzip -nq9" logdir
Yes, something like that would work. No need for a fifodir: a simple named pipe would do, just make sure only your logger writes to it and only your service reads from it. My take would be something like: ./run: fdmove -c 2 1 foreground { mkfifo readiness-fifo } background -d { fdmove 1 3 redirfd -r 0 readiness-fifo head -n 1 } fdclose 3 daemon ./log/run: redirfd -w 1 ../readiness-fifo s6-log - +"daemon is ready" 1 rest-of-your-logging-script -- Laurent