From 5bef4251c76db2be3e7d0b8ad19a27553b57ba3b Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Tue, 29 Mar 2022 18:42:15 +0300 Subject: [PATCH] Move failed probes to the beginning --- status.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/status.sh b/status.sh index d3eec5b..d0c7243 100755 --- a/status.sh +++ b/status.sh @@ -10,6 +10,9 @@ catfiles() { SGMONDIR="$(dirname "$(realpath -- "$0")")" . "$SGMONDIR"/rc probes="$("$SGMONDIR"/probelist.sh)" +gut=`mktemp` +bad=`mktemp` +trap "rm -fr $gut $bad" HUP PIPE INT QUIT TERM EXIT cat < sgmon status $(date -Iseconds) @@ -24,6 +27,7 @@ for probe in $probes ; do [ "$attempts" -lt "$max_attempts" ] && status="Prefail" || status="FAIL" status="$status (${attempts}/${max_attempts})" + list=$bad else if [ -r $probe/state/ok ] ; then mtime=$(stat -t "%F %T" -f %Sm $probe/state/ok) @@ -32,8 +36,9 @@ for probe in $probes ; do mtime= status="???" fi + list=$gut fi - cat <>$list < $status $probe @@ -42,4 +47,5 @@ for probe in $probes ; do EOF done +cat $bad $gut echo "" -- 2.44.0