!7 cmodule RebootConsciousness > DynPrintLogAndEnabled { start-thread { theTest(); } void theTest { LS lastLines = unquoteAll(lastNLines(2, rebootLogFile())); pnl(lastLines); if (empty(lastLines)) ret; if (l(lastLines) == 1) ret with confused("Only one event: " + lastLines); S line1 = first(lastLines), line2 = second(lastLines); new Matches m; new Matches m2; if (match("* Rebooting computer", line1, m) && match("* Boot timestamp changed from * to *", line2, m2)) { long ts1 = parseLong(m.get(0)), ts2 = parseLong(m2.get(2)); if (ts2 > ts1) notConfused("All OK! Reboot followed my reboot command"); else confused("Timestamps are weird: " + lastLines); } else confused("Was expecting reboot cmd & then reboot effect: " + lastLines); } void confused(S msg) { print("Confused: " + msg); } void notConfused(S msg) { print("I am very satisfied. " + msg); } }