diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-05-29 19:07:59 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-05-29 19:07:59 +0200 |
commit | fc92257dc31908454bb0c89a9adbafe031a6e743 (patch) | |
tree | e2dc05e0f124b009631d7c05c3e6c83b9f438816 | |
parent | 4f02d7866709d630d9e1ff09319507a1247d3d3e (diff) |
More journalctl-related fixes
-rwxr-xr-x | buildos | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -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 |