Improve logging of forking services having started and stopped

Since a forking service, e.g. a sysv init script, will exit very early
we cannot log the same as for regular services "Starting foo[123]", so
instead we log "Started bar[321]" when we get the pidfile update and
the same when stopping a forking service, log "Stopped bar[321]" when
we collect the PID.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2022-04-26 20:58:57 +02:00
1 parent 2ddbb805ca
commit b01f9f38f2
2 files changed
+12 -3

No files matched your search

+3
View File
@@ -102,6 +102,9 @@ static void pidfile_update_conds(char *dir, char *name, uint32_t mask)
_d("Forking service %s changed PID from %d to %d",
svc->cmd, svc->pid, pid);
svc->pid = pid;
/* Complement log in service.c for non-forking services */
logit(LOG_CONSOLE | LOG_NOTICE, "Started %s[%d]", svc_ident(svc, NULL, 0), pid);
}
}