Reset the starting flag of a service when stopping it

When a service is started and then stopped before it has created it's pid file,
it could be left forever in the "stopping" state, if we don't reset the
starting flag.

Signed-off-by: Jacques de Laval <Jacques.De.Laval@westermo.com>
This commit is contained in:
Jacques de Laval
2021-06-02 17:01:01 +02:00
parent 41a14391a2
commit ee67c08b64
+7
View File
@@ -725,6 +725,13 @@ static int service_stop(svc_t *svc)
logit(LOG_CONSOLE | LOG_NOTICE, "Calling '%s stop' ...", svc->cmd);
}
/*
* Make sure we are no longer considering the service to be starting (if
* that was the case). service_monitor() might get confused otherwise, and
* leave the service in a lingering, "stopping", state.
*/
svc_started(svc);
svc_set_state(svc, SVC_STOPPING_STATE);
if (!svc->desc[0])