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 <<EOF
<!DOCTYPE html>
<html><head><title>sgmon status $(date -Iseconds)</title></head><body>
[ "$attempts" -lt "$max_attempts" ] &&
status="<b>Prefail</b>" || status="<b>FAIL</b>"
status="$status (${attempts}/${max_attempts})"
+ list=$bad
else
if [ -r $probe/state/ok ] ; then
mtime=$(stat -t "%F %T" -f %Sm $probe/state/ok)
mtime=
status="???"
fi
+ list=$gut
fi
- cat <<EOF
+ cat >>$list <<EOF
<tr>
<td>$status</td>
<td><tt><a name="$probe">$probe</a></tt></td>
</tr>
EOF
done
+cat $bad $gut
echo "</table></body></html>"