From fc92257dc31908454bb0c89a9adbafe031a6e743 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 29 May 2017 19:07:59 +0200 Subject: More journalctl-related fixes --- buildos | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'buildos') diff --git a/buildos b/buildos index c1e6f7e..45a4b38 100755 --- a/buildos +++ b/buildos @@ -986,7 +986,8 @@ EOF # Plus, it sometimes changes the cursor even without any errors in # it (journal rewind/truncation maybe?) so we have to detect that. # - c=(sudo journalctl --unit "bbot-agent@$tn") + c=(sudo journalctl --no-pager --quiet --output short-full \ + --unit "bbot-agent@$tn") # Get the last cursor if any. # @@ -1014,8 +1015,7 @@ EOF # hold space with the next line so that at the end we have the # last line there. # - lr="$("${c[@]}" --no-pager --quiet --output short-full \ ---priority 4 --show-cursor | sed -n -r \ + lr="$("${c[@]}" --priority 4 --show-cursor | sed -n -r \ -e '1{h;s/^[MTWFS].. ([^ ]+ [^ ]+) .*$/\1/p;t}' \ -e '${x;s/^[MTWFS].. ([^ ]+ [^ ]+) .*$/\1/p;x;s/^-- cursor: (.+)$/\1/p;t}' \ -e 'h')" @@ -1053,13 +1053,14 @@ EOF echo; echo "summary:"; echo; - "${c[@]}" --no-pager --quiet --output short-full \ - --priority 4 | head -n 200; + "${c[@]}" --priority 4 | head -n 200; echo; echo "context [$sd -- $ed]:"; echo; - "${c[@]}" --no-pager --quiet --output short-full \ - --since "$sd" --until "$ed" | head -n 200 + if [ -n "$oc" ]; then + unset 'c[${#c[@]}-2]' # Pop cursor (for --since/--until). + fi; + "${c[@]}" --since "$sd" --until "$ed" | head -n 200 } | email "$s" fi -- cgit v1.1