Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
monitor: announce other service states
cmd/beterrabamon/main.ha | 8 +++++---
diff --git a/cmd/beterrabamon/main.ha b/cmd/beterrabamon/main.ha index 48b2991c96530a6ec8e9339045364ae40ed3822c..b8e87c74d937a4a289663294652bd764b08f9aa4 100644 --- a/cmd/beterrabamon/main.ha +++ b/cmd/beterrabamon/main.ha @@ -30,21 +30,23 @@ yield s; case let err: exec::error => // TODO: End gracefully when daemon dies log::printfln("Something went wrong on wait"); - abort(); + break; }; match (exec::exit(&exit_status)) { case let s: exec::exited => - // TODO: Announce that this service has exited normally + announce(&conn, "stopped", svc.name); log::printfln("Exited with status {}", exec::exitstr(s)); case let s: exec::signaled => if (s == signal::SIGSEGV) { + announce(&conn, "crashed", svc.name); log::printfln("We need to restart"); time::sleep(1 * time::SECOND); // TODO: Announce that this service has crashed pid = boot(&svc); } else { - // TODO: Announce that this service has died + // TODO: Store the exit status of the service + announce(&conn, "crashed", svc.name); log::printfln("Died of {}", exec::exitstr(s)); }; };