diff options
Diffstat (limited to 'init/signal_handler.c')
| -rw-r--r-- | init/signal_handler.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/init/signal_handler.c b/init/signal_handler.c index abccb40..d31ad63 100644 --- a/init/signal_handler.c +++ b/init/signal_handler.c @@ -63,7 +63,7 @@ static int wait_for_one_process(int block) NOTICE("process '%s', pid %d exited\n", svc->name, pid); - if (!(svc->flags & SVC_ONESHOT)) { + if (!(svc->flags & SVC_ONESHOT) || (svc->flags & SVC_RESTART)) { kill(-pid, SIGKILL); NOTICE("process '%s' killing any children in process group\n", svc->name); } @@ -78,8 +78,9 @@ static int wait_for_one_process(int block) svc->pid = 0; svc->flags &= (~SVC_RUNNING); - /* oneshot processes go into the disabled state on exit */ - if (svc->flags & SVC_ONESHOT) { + /* oneshot processes go into the disabled state on exit, + * except when manually restarted. */ + if ((svc->flags & SVC_ONESHOT) && !(svc->flags & SVC_RESTART)) { svc->flags |= SVC_DISABLED; } @@ -90,7 +91,7 @@ static int wait_for_one_process(int block) } now = gettime(); - if (svc->flags & SVC_CRITICAL) { + if ((svc->flags & SVC_CRITICAL) && !(svc->flags & SVC_RESTART)) { if (svc->time_crashed + CRITICAL_CRASH_WINDOW >= now) { if (++svc->nr_crashed > CRITICAL_CRASH_THRESHOLD) { ERROR("critical process '%s' exited %d times in %d minutes; " @@ -105,6 +106,7 @@ static int wait_for_one_process(int block) } } + svc->flags &= (~SVC_RESTART); svc->flags |= SVC_RESTARTING; /* Execute all onrestart commands for this service. */ |
