1
0
Fork 0
mirror of https://github.com/pygos/init.git synced 2024-11-05 04:07:10 +01:00

Keep original respawn limit

We also want this meachanism to still work for manually started
service (especially after reloading services).

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2019-03-29 13:46:56 +01:00
parent be06641904
commit c8c0f10ce1
2 changed files with 4 additions and 5 deletions

View file

@ -82,9 +82,9 @@ static void handle_terminated_service(service_t *svc)
break;
if (svc->rspwn_limit > 0) {
svc->rspwn_limit -= 1;
svc->rspwn_count += 1;
if (svc->rspwn_limit == 0) {
if (svc->rspwn_count >= svc->rspwn_limit) {
print_status(svc->desc, STATUS_FAIL, false);
goto out_failure;
}
@ -319,9 +319,7 @@ void supervisor_start(int id)
}
return;
found:
if (svc->type == SVC_RESPAWN)
svc->rspwn_limit = 0;
svc->rspwn_count = 0;
svc->flags &= ~SVC_FLAG_ADMIN_STOPPED;
svc->next = queue;
queue = svc;

View file

@ -56,6 +56,7 @@ typedef struct service_t {
char *desc; /* description string */
char *ctty; /* controlling tty or log file */
int rspwn_limit; /* maximum respawn count */
int rspwn_count; /* services respawn counter */
unsigned int flags; /* SVC_FLAG_* bit field */
/* linked list of command lines to execute */