From 028394b8a5c6745bbf3ee34ba71d148bca75d247 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 25 Mar 2019 17:16:34 +0100 Subject: Add service configuration reloading This commit add the ability to initd to reload the service configuration while running. The new configuration is merged with the existing one as follows: For each target: - If the existing service list is not NULL, we have not started that target yet. Simply replace it with the new list. - If it is NULL, the services have already been started. - First, remove all entries for services in that target that no loner exist (except from the 'running' list). - Second, add new services that we don't have yet. Treat them as recently diseased and let the user start them manualy. Signed-off-by: David Oberhollenzer --- cmd/service/disable.c | 3 +++ cmd/service/enable.c | 3 +++ 2 files changed, 6 insertions(+) (limited to 'cmd') diff --git a/cmd/service/disable.c b/cmd/service/disable.c index 6210a8c..ffaab0a 100644 --- a/cmd/service/disable.c +++ b/cmd/service/disable.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -55,6 +56,8 @@ static int cmd_disable(int argc, char **argv) goto out; } + kill(1, SIGHUP); + ret = EXIT_SUCCESS; out: free(linkname); diff --git a/cmd/service/enable.c b/cmd/service/enable.c index 67cf0aa..8734aec 100644 --- a/cmd/service/enable.c +++ b/cmd/service/enable.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -60,6 +61,8 @@ static int cmd_enable(int argc, char **argv) goto out; } + kill(1, SIGHUP); + ret = EXIT_SUCCESS; out: free(linkname); -- cgit v1.2.3