From: Sergey Matveev Date: Tue, 29 Mar 2022 15:42:15 +0000 (+0300) Subject: Move failed probes to the beginning X-Git-Url: http://www.git.stargrave.org/?p=sgmon.git;a=commitdiff_plain;h=5bef4251c76db2be3e7d0b8ad19a27553b57ba3b Move failed probes to the beginning --- 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 ""