2 # Copyright (C) 2019 Ian Kelling
3 # SPDX-License-Identifier: AGPL-3.0-or-later
5 if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi
7 source /a
/bin
/errhandle
/err
12 # this list duplicated in brc2 ralerts
13 for h
in bk je li frodo kwwg x3wg x2wg kdwg sywg
; do
14 statedir
=/b
/bash_unpublished
/mailq-state
15 statefile
=$statedir/$h
16 [[ -d $statedir ]] ||
continue
17 if [[ $HOSTNAME == "${h%wg}" ]]; then
21 if c
=$
(timeout
-v 10 ssh root@
$h.b8.nz
/usr
/local
/bin
/check-mailq
2>&1 ); then
27 if [[ -s $statefile ]]; then
28 logsec
=$
(date +%s
-d "$(head -n1 $statefile | awk '{print $1,$2}')")
37 if (( logsec
< EPOCHSECONDS
- 60*60*hours
)); then
38 echo $0: host $h ssh /usr
/local
/bin
/check-mailq fail
for over
$hours hours
41 printf "%s\n" "$c" | ts
"%F %T" >> $statefile