mirror of
https://github.com/troglobit/finit.git
synced 2026-10-02 14:02:52 +07:00
services: remove .pid file for (careless) died processes
Signed-off-by: Jonas Johansson <jonas.johansson@westermo.se>
This commit is contained in:
@@ -600,6 +600,7 @@ void service_unregister(svc_t *svc)
|
|||||||
void service_monitor(pid_t lost)
|
void service_monitor(pid_t lost)
|
||||||
{
|
{
|
||||||
svc_t *svc;
|
svc_t *svc;
|
||||||
|
char pidfile[MAX_ARG_LEN];
|
||||||
|
|
||||||
if (fexist(SYNC_SHUTDOWN) || lost <= 1)
|
if (fexist(SYNC_SHUTDOWN) || lost <= 1)
|
||||||
return;
|
return;
|
||||||
@@ -619,6 +620,10 @@ void service_monitor(pid_t lost)
|
|||||||
|
|
||||||
_d("collected %s(%d)", svc->cmd, lost);
|
_d("collected %s(%d)", svc->cmd, lost);
|
||||||
|
|
||||||
|
/* Remove pid file (in case service is careless) */
|
||||||
|
snprintf(pidfile, sizeof(pidfile), "%s%s.pid", _PATH_VARRUN, basename(svc->cmd));
|
||||||
|
remove(pidfile);
|
||||||
|
|
||||||
/* No longer running, update books. */
|
/* No longer running, update books. */
|
||||||
svc->pid = 0;
|
svc->pid = 0;
|
||||||
service_step(svc);
|
service_step(svc);
|
||||||
|
|||||||
Reference in New Issue
Block a user