Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
monitor: add some notes regarding log
cmd/beterrabamon/main.ha | 21 +++++++++++++++++++++
diff --git a/cmd/beterrabamon/main.ha b/cmd/beterrabamon/main.ha index b8e87c74d937a4a289663294652bd764b08f9aa4..e53fda4d20ecbce6b6887aea59f931cf4286e8a6 100644 --- a/cmd/beterrabamon/main.ha +++ b/cmd/beterrabamon/main.ha @@ -19,6 +19,8 @@ const name = os::args[1]; const conn = conn(); defer io::close(conn)!; + prepare(); + const svc = retrieve(&conn, name); let pid = boot(&svc); announce(&conn, "started", svc.name); @@ -52,6 +54,25 @@ }; }; //wait(&pid); }; +}; + +// Create the directory suitable for storing state from this monitor +// it should also setup a logger to that place, and redirect the stdout/stderr +// from the command that we're monitoring to that log via os::exec::pipe. Later +// on, we'll pipe the stdout/stderr from the monitor itself (so messages such as +// failures or anything non-essential) to the daemon log (so technically the +// daemon will have to grab the stdout/stderr from the monitor and just pipe to +// it's own logger. In the end we'll have the following structure: +// +// daemon -> /var/log/beterrabad/daemon.log +// |------- monitor -> /var/log/beterrabad/daemon.log +// |------- cmd -> /var/log/beterrabad/monitors/cmd.log +// +// (and so on) +// +fn prepare() void = { + // TODO: Implement the above + //fs::mkdir }; fn conn() net::socket = {