Skip to content

Commit 5bbfe47

Browse files
committed
Additional checks for forking services before marking as started
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
1 parent 7b78a01 commit 5bbfe47

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

plugins/pidfile.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,6 @@ static void pidfile_update_conds(char *dir, char *name, uint32_t mask)
120120
}
121121

122122
if (mask & (IN_CLOSE_WRITE | IN_ATTRIB | IN_MODIFY | IN_MOVED_TO)) {
123-
/*
124-
* only mark native services as started, the s6 and
125-
* systemd style services rely on their respective
126-
* readiness notification. Issue #343
127-
*/
128-
if (svc->notify == SVC_NOTIFY_PID)
129-
svc_started(svc);
130-
131123
if (!svc_has_pidfile(svc)) {
132124
dbg("Setting %s PID file to %s", svc->name, fn);
133125
pid_file_set(svc, fn, 1);
@@ -153,9 +145,23 @@ static void pidfile_update_conds(char *dir, char *name, uint32_t mask)
153145
svc->pid = pid;
154146

155147
/* Complement log in service.c for non-forking services */
156-
logit(LOG_CONSOLE | LOG_NOTICE, "Started %s[%d]", svc_ident(svc, NULL, 0), pid);
148+
if (svc->state != SVC_RUNNING_STATE) {
149+
if (svc->notify == SVC_NOTIFY_PID)
150+
svc_started(svc);
151+
152+
logit(LOG_CONSOLE | LOG_NOTICE, "Started %s[%d]",
153+
svc_ident(svc, NULL, 0), pid);
154+
}
157155
cgroup_move_svc(svc);
158156
}
157+
} else {
158+
/*
159+
* only mark native services as started, the s6 and
160+
* systemd style services rely on their respective
161+
* readiness notification. Issue #343
162+
*/
163+
if (svc->notify == SVC_NOTIFY_PID)
164+
svc_started(svc);
159165
}
160166

161167
if (svc->notify == SVC_NOTIFY_PID)

0 commit comments

Comments
 (0)