diff options
author | Gerrit Pape <pape@smarden.org> | 2003-04-24 13:10:27 +0000 |
---|---|---|
committer | Gerrit Pape <pape@smarden.org> | 2003-04-24 13:10:27 +0000 |
commit | 588d75c59cb7fbd19b2192477843dd90472ca46f (patch) | |
tree | 6b11eb8583e4be3e19222bbc65b9eda22b78d141 /src | |
parent | 6e612f79557b0e2b4ffe8651637bc076a08931b6 (diff) | |
download | runit-588d75c59cb7fbd19b2192477843dd90472ca46f.tar.gz runit-588d75c59cb7fbd19b2192477843dd90472ca46f.tar.xz runit-588d75c59cb7fbd19b2192477843dd90472ca46f.zip |
* runit.c: print warning for each state that exits non-zero; restart
stage 2 if it exits non-zero. minor.
Diffstat (limited to 'src')
-rw-r--r-- | src/runit.c | 22 | ||||
-rw-r--r-- | src/svwaitdown.c | 15 |
2 files changed, 28 insertions, 9 deletions
diff --git a/src/runit.c b/src/runit.c index 44534fb..5637d75 100644 --- a/src/runit.c +++ b/src/runit.c @@ -157,15 +157,19 @@ int main (int argc, const char * const *argv, char * const *envp) { } if (child == pid) { - if (wait_crashed(wstat)) { - strerr_warn3(WARNING, "child crashed: ", stage[st], 0); - if (st == 0) { - /* this is stage 1 */ - strerr_warn3(INFO, "leave stage: ", stage[st], 0); - strerr_warn2(WARNING, "skipping stage 2...", 0); - st++; - break; - } + if (wait_exitcode(wstat) != 0) { + if (wait_crashed(wstat)) { + strerr_warn3(WARNING, "child crashed: ", stage[st], 0); + if (st == 0) { + /* this is stage 1 */ + strerr_warn3(INFO, "leave stage: ", stage[st], 0); + strerr_warn2(WARNING, "skipping stage 2...", 0); + st++; + break; + } + } + else + strerr_warn3(WARNING, "child failed: ", stage[st], 0); if (st == 1) { /* this is stage 2 */ strerr_warn2(WARNING, "killing all processes in stage 2...", 0); diff --git a/src/svwaitdown.c b/src/svwaitdown.c index ec36e33..dfa748f 100644 --- a/src/svwaitdown.c +++ b/src/svwaitdown.c @@ -65,6 +65,19 @@ int main(int argc, const char * const *argv) { if (! argv || ! *argv) usage(); dir =argv; + while (*dir) { + if ((fd =open_write("supervise/control")) == -1) { + dir++; /* bummer */ + continue; + } + if (write(fd, "dx", 1 +doexit) != (1 +doexit)) { + close(fd); dir++; /* bummer */ + continue; + } + close(fd); + } + dir =argv; + tai_now(&start); while (*dir) { if (*dir[0] != '/') { @@ -118,8 +131,10 @@ int main(int argc, const char * const *argv) { } if (write(fd, "dx", 1 +doexit) != (1 +doexit)) { warn(*dir, ": unable to write to supervise/control: ", &strerr_sys); + close(fd); continue; } + close(fd); } tai_now(&now); |