mirror of
https://github.com/troglobit/finit.git
synced 2026-10-31 13:00:32 +00:00
Mark affected services as dirty if their rdeps are dirty
Provided a configuration that looks like this:
ospfd.conf:
service [2345] <!pid/zebra> log ospfd -A 127.0.0.1 -u root -g root -- OSPF daemon
zebra.conf:
service [2345] <!> log zebra -A 127.0.0.1 -u root -g root -- Zebra Routing daemon
If zebra.conf is changed, we restart it when `initctl reload` is issued.
This change ensures that ospfd is also restarted, because ospfd depends
on zebra, we must restart it too.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
289247dab9
commit
4d05bf9359
5 files changed
+55
-20
No files matched your search
@@ -1250,6 +1250,38 @@ void service_monitor(pid_t lost, int status)
|
||||
sm_step(&sm);
|
||||
}
|
||||
|
||||
static void svc_mark_affected(char *cond)
|
||||
{
|
||||
svc_t *svc, *iter = NULL;
|
||||
|
||||
for (svc = svc_iterator(&iter, 1); svc; svc = svc_iterator(&iter, 0)) {
|
||||
if (!svc_has_cond(svc))
|
||||
continue;
|
||||
|
||||
if (cond_affects(cond, svc->cond))
|
||||
svc_mark_dirty(svc);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Called on conf_reload() to update service reverse dependencies.
|
||||
* E.g., if ospfd depends on zebra and the zebra Finit conf has
|
||||
* changed, we need to mark the ospfd Finit conf as changed too.
|
||||
*/
|
||||
void service_update_rdeps(void)
|
||||
{
|
||||
svc_t *svc, *iter = NULL;
|
||||
|
||||
for (svc = svc_iterator(&iter, 1); svc; svc = svc_iterator(&iter, 0)) {
|
||||
char cond[MAX_COND_LEN];
|
||||
|
||||
if (!svc_is_changed(svc))
|
||||
continue;
|
||||
|
||||
svc_mark_affected(mkcond(svc, cond, sizeof(cond)));
|
||||
}
|
||||
}
|
||||
|
||||
static void service_retry(svc_t *svc)
|
||||
{
|
||||
int timeout;
|
||||
|
||||
Reference in new issue
Block a user