From 06aea7d3f3bb5568fdb063e8a144e16221de3819 Mon Sep 17 00:00:00 2001 From: Jacques de Laval Date: Tue, 16 Feb 2021 19:30:47 +0100 Subject: [PATCH] Keep logit alive until stdin is closed By not putting logit in the same process group as the service whose output is consumed by logit, we can send signals to the service, and it's group, without affecting logit. This means that logit will continue to log away until it's stdin is closed, which will happen when the service is reaped. Signed-off-by: Jacques de Laval --- src/service.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/service.c b/src/service.c index 129f305b..b64bdec7 100644 --- a/src/service.c +++ b/src/service.c @@ -371,6 +371,9 @@ static int service_start(svc_t *svc) } args[i] = NULL; + redirect(svc); + sig_unblock(); + /* * The setsid() call is the most humble of all in this * function. It takes care to detach the process from @@ -385,9 +388,6 @@ static int service_start(svc_t *svc) */ setsid(); - redirect(svc); - sig_unblock(); - if (svc_is_runtask(svc)) status = exec_runtask(svc->cmd, args); else