Fix #300: add ready:script for services, called when daemon is ready

In Finit a daemon can signal its readiness by creating/touching its PID
file.  An ancient UNIX concept -- a daemon creates its PID file when it
has set up signal handlers and is ready to receive IPC (signals), right
before entering its while(1) loop.

Finit took the concept a bit further, adding readiness signalling also
to daemon's by touching their PID file after having processed a SIGHUP.

For both these conditions Finit now supports a ready:script, called when
readiness is detected.  In later commits support for s6 and systemd
style readiness notification will be added that will hook the mechanism
implemented in this commit as well.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2022-08-23 09:37:18 +02:00
1 parent 0ae5071f94
commit abcb3ceb67
4 files changed
+55 -1

No files matched your search

+7
View File
@@ -297,10 +297,17 @@ int cond_set_noupdate(const char *name)
void cond_set(const char *name)
{
svc_t *svc;
_d("%s", name);
if (cond_set_noupdate(name))
return;
/* XXX: refactor when new notify framework is in place */
svc = svc_find_by_cond(name);
if (svc && svc_has_ready(svc))
service_ready_script(svc);
cond_update(name);
}