dinit
dinit copied to clipboard
external readiness notification mechanism
I wonder if it would be worthwhile to implement another mechanism for readiness notification of services. Currently we can do that from the service itself using a file descriptor passed either directly or through an environment variable. This is a simple and fairly flexible mechanism, but it cannot be applied universally.
I was thinking of possibly introducing a new mechanism that would utilize some kind of ready-command field. I'm thinking the system could simply do:
- If present, issue the command alongside the service's command
- Wait for the
ready-commandto exit - If the exit status of it was 0, service is considered ready
- In case of a non-zero exit status, bring down the service
This could be adapted to lots of things that do not directly support any kind of readiness notification. In my particular case I would use this for the dbus activation support I am working on (the command would take care of waiting for the service to appear on the bus).
WDYT?
Yes, seems reasonable
I think that, while it's a bit clunky, you could probably achieve the same overall effect using multiple services:
- a master service, which depends on the other two
- a process or bgprocess service for the service process itself
- a scripted service which is the readiness notification
The master service state will only become "started" once both the underlying services are started, meaning that the readiness check must have completed. I hope that makes sense.
i guess that could work, but yeah it's a tad clunky (maybe it wouldn't matter that much in my use case though)
i think this could even be done with just two services? the readiness service would be scripted and depend on the actual process service; if the process service does not have a readiness check, it would immediately be started, followed by the scripted one, which would wait for the script to finish, itself becoming started
Yep, that should work I think
this can actually be implemented with one command, i've already done so for what i had in mind: https://github.com/chimera-linux/dbus-wait-for
so i think there is no need to have this feature in dinit
Ok, closing at least for now.