diff --git a/plugins/pidfile.c b/plugins/pidfile.c index 791c611f..2ac5fc39 100644 --- a/plugins/pidfile.c +++ b/plugins/pidfile.c @@ -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); } } diff --git a/src/service.c b/src/service.c index 53991537..5f333919 100644 --- a/src/service.c +++ b/src/service.c @@ -1537,11 +1537,17 @@ void service_monitor(pid_t lost, int status) } /* Forking sysv/services declare themselves with pid:!/path/to/pid.file */ - if (svc_is_starting(svc) && svc_is_forking(svc)) { - svc->pid = 0; /* Expect no more activity from this one */ - return; + if (svc_is_forking(svc)) { + /* Likely start script exiting */ + if (svc_is_starting(svc)) { + svc->pid = 0; /* Expect no more activity from this one */ + return; + } + + logit(LOG_CONSOLE | LOG_NOTICE, "Stopped %s[%d]", svc_ident(svc, NULL, 0), lost); } + /* Terminate any children in the same proess group, e.g. logit */ kill(-svc->pid, SIGKILL);