From c554a325fe81aab90f4816600849f6c4f901b2f9 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Thu, 30 Sep 2021 21:08:25 +1000 Subject: [PATCH] ctdb-daemon: Enable log reopening for recovery daemon Pass on a SIGHUP to the recovery daemon, which will then reopen its logs. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/server/ctdb_daemon.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c index 482a67ef253..d0f3a8ae1a3 100644 --- a/ctdb/server/ctdb_daemon.c +++ b/ctdb/server/ctdb_daemon.c @@ -1488,6 +1488,16 @@ static void fork_only(void) } } +static void sighup_hook(void *private_data) +{ + struct ctdb_context *ctdb = talloc_get_type_abort(private_data, + struct ctdb_context); + + if (ctdb->recoverd_pid > 0) { + kill(ctdb->recoverd_pid, SIGHUP); + } +} + /* start the protocol going as a daemon */ @@ -1551,8 +1561,8 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, status = logging_setup_sighup_handler(ctdb->ev, ctdb, - NULL, - NULL); + sighup_hook, + ctdb); if (!status) { D_ERR("Failed to set up signal handler for SIGHUP\n"); exit(1); -- 2.34.1