aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-05-29 19:07:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-05-29 19:07:59 +0200
commitfc92257dc31908454bb0c89a9adbafe031a6e743 (patch)
treee2dc05e0f124b009631d7c05c3e6c83b9f438816
parent4f02d7866709d630d9e1ff09319507a1247d3d3e (diff)
More journalctl-related fixes
-rwxr-xr-xbuildos15
1 files changed, 8 insertions, 7 deletions
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