From e69200ea436095db691589f2d3dd738a1335f2e9 Mon Sep 17 00:00:00 2001 From: Mattias Barthel Date: Mon, 25 Aug 2025 17:41:33 +0200 Subject: [PATCH] Add exit status/signal info when a process dies Signed-off-by: Mattias Barthel --- src/service.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/service.c b/src/service.c index 0d8c8cf1..9e386a45 100644 --- a/src/service.c +++ b/src/service.c @@ -2522,8 +2522,13 @@ static void service_retry(svc_t *svc) timeout = ((*restart_cnt) <= (svc->restart_max / 2)) ? 2000 : 5000; /* If a longer timeout was specified in the conf, use that instead. */ svc->restart_tmo = max(svc->restart_tmo, timeout); - logit(LOG_CONSOLE|LOG_WARNING, "Service %s[%d] died, restarting (retry in %d msec) (attempt: %d/%d)", - svc_ident(svc, NULL, 0), svc->oldpid, svc->restart_tmo, *restart_cnt, svc->restart_max); + logit(LOG_CONSOLE|LOG_WARNING, "Service %s[%d] died (%s%d), restarting (retry in %d msec) (attempt: %d/%d)", + svc_ident(svc, NULL, 0), svc->oldpid, + WIFEXITED(svc->status) ? "with exit status: " : "by signal: ", + WIFEXITED(svc->status) ? WEXITSTATUS(svc->status) : WTERMSIG(svc->status), + svc->restart_tmo, + *restart_cnt, + svc->restart_max); svc_unblock(svc); service_step(svc);