From 060de93b5b40c41569576b210ce0510e43378855 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Mon, 1 Oct 2018 10:54:56 +0200 Subject: [PATCH] Wait for all services to complete before changing runlevel We allow all run/task/services to complete before changing runlevel. This means stepping them all while we wait for their completion, since services may depend on each other. Signed-off-by: Joachim Nilsson --- src/finit.c | 3 +++ src/service.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/finit.c b/src/finit.c index 2d02b369..71272882 100644 --- a/src/finit.c +++ b/src/finit.c @@ -481,6 +481,9 @@ int main(int argc, char* argv[]) api_init(&loop); umask(022); + /* Finalize bootstrap, allow service/run/tasks to complete */ + service_step_all(SVC_TYPE_ANY); + /* * Wait for all SVC_TYPE_RUNTASK to have completed their work in * [S], or timeout, before calling finalize() diff --git a/src/service.c b/src/service.c index 097837da..13b85609 100644 --- a/src/service.c +++ b/src/service.c @@ -1267,6 +1267,9 @@ void service_bootstrap_cb(uev_t *w, void *arg, int events) static int cnt = 120; void (*finalize)(void) = arg; + _d("Step all services ..."); + service_step_all(SVC_TYPE_ANY); + _d("Checking completion of all run/task ... %d", cnt); if (cnt-- > 0 && !service_runtask_completed(!runlevel)) return;