s6
Software
skarnet.org

The s6-notify-socket-from-fd program

s6-notify-socket-from-fd is different from other chainloading tools in s6: it's not meant to be used in s6 run scripts. Instead, it's meant to be used when you're not using s6, but another service manager that does not support the s6 readiness notification protocol, but supports the NOTIFY_SOCKET protocol.

Typically, you would use it if you have a daemon foobard that uses the s6 readiness notification protocol, but need to run that daemon under systemd. Instead of running it with ExecStart=foobard and having to use Type=main, losing the benefit of notification, you can use ExecStart="s6-notify-socket-from-fd foobard" and Type=notify, and systemd will handle readiness correctly.

Interface

     s6-notify-socket-from-fd [ -d fd ] [ -f ] [ -t timeout ] [ -k ] prog...

Exit codes

s6-notify-socket-from-fd can exit before executing into prog:

After forking, s6-notify-socket-from-fd (running as a child or grandchild) can exit with the following exit codes, but those are meaningless because no process will, or should, check them. They are only differentiated for clarity in the source code:

Options

-d fd, --notification-fd=fd
Expect prog... to send its notification on descriptor fd. Default is 1.
-t timeout, --timeout=timeout
Exit without notifying the supervisor if prog hasn't notified readiness after timeout milliseconds. Default is 0, meaning infinite: s6-notify-socket-from-fd will wait forever for a notification, up to when prog exits.
-f, --no-doublefork
Make s6-notify-socket-from-fd live as a direct child of prog rather than doubleforking. It is less costly (it might save a millisecond), but it will leave a zombie around if prog does not know how to reap its bastards (children it doesn't know it has). If prog reaps everything, you can safely use this option; otherwise, leave it alone.
-k, --keep-environment
Keep the NOTIFY_SOCKET environment variable in prog's environment. By default, the variable is removed from it, because prog, not using the systemd notification protocol, normally has no use for it.

Notes