Avoid unnecessary restarts of services that do not support SIGHUP

When a service's condition transitions to `flux`, put it in the
waiting state, even if it does not support SIGHUP. That way, if the
condition returns to `on` we can simply SIGCONT it. If it goes to
`off` it will still be stop/started as before.
This commit is contained in:
Tobias Waldekranz
2016-02-05 13:45:06 +01:00
parent e8d699c194
commit c6055031b8
+13 -14
View File
@@ -867,30 +867,29 @@ restart:
}
cond = cond_get_agg(svc->cond);
if (cond == COND_OFF ||
(!svc->sighup && (cond < COND_ON || svc_is_changed(svc)))) {
switch (cond) {
case COND_OFF:
service_stop(svc);
svc_set_state(svc, SVC_STOPPING_STATE);
break;
}
if (cond == COND_FLUX) {
case COND_FLUX:
kill(svc->pid, SIGSTOP);
svc_set_state(svc, SVC_WAITING_STATE);
break;
}
if (svc_is_changed(svc)) {
if (svc->sighup) {
service_restart(svc);
} else {
service_stop(svc);
svc_set_state(svc, SVC_STOPPING_STATE);
case COND_ON:
if (svc_is_changed(svc)) {
if (svc->sighup) {
service_restart(svc);
} else {
service_stop(svc);
svc_set_state(svc, SVC_STOPPING_STATE);
}
svc_mark_clean(svc);
}
svc_mark_clean(svc);
break;
}
break;
case SVC_WAITING_STATE: