--- /dev/null
+#!/bin/bash
+# Copyright (C) 2019 Ian Kelling
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
+if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi
+
+source /a/bin/errhandle/err
+
+shopt -s nullglob
+shopt -s dotglob
+
+
+for h in tp.b8.nz vpn1 x2 x3.b8.nz frodo.b8.nz kd.b8.nz kw; do
+ if [[ $HOSTNAME == "${h%%.*}" ]]; then
+ continue
+ fi
+ if c=$(timeout 1 ssh $h /usr/sbin/exiqgrep -o 60 -c -b 2>/dev/null | awk '{print $1}' ) && [[ $c && $c != 0 ]]; then
+ echo q:$h=$c
+ fi
+done
# dont use buster because it causes dist-upgrade to think its downgrading
# packages while really just reinstalling the same version.
f=/etc/apt/apt.conf.d/01iank
- rm -f $f
+ s rm -f $f
# # stupid buster uses some key algorithm not supported by flidas gpg that apt uses.
# s dd of=/etc/apt/apt.conf.d/01iank <<'EOF'
# Acquire::AllowInsecureRepositories "true";
# EOF
f=/etc/apt/sources.list.d/buster.list
- rm -f $f
+ s rm -f $f
# t=$(mktemp)
# cat >$t <<EOF
# deb http://http.us.debian.org/debian buster main
[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@"
+if [[ ! -s /var/log/exim4/paniclog ]]; then
+ exit 0
+fi
wipe=false
while read -r d1 d2; do
*/10 * * * * iank /a/exe/rootsshsync 2>&1 | /usr/local/bin/log-once -15 rootsshsync
# this goes into bash prompt, does in cron for more efficient shell
* * * * * iank /a/exe/system-status 2>&1 | /usr/local/bin/log-once system-status
+2 * * * * iank /a/exe/check-remote-mailqs 2>&1 | /usr/local/bin/log-once check-remote-mailqs
chars+=("MAILPING!")
fi
- qlen=$(/usr/sbin/exim -bpc)
+ qlen=$(/usr/sbin/exiqgrep -o 60 -c -b | awk '{print $1}')
if ((qlen)); then
chars+=("q $qlen")
fi
spamcount=0
fi
if (( spamcount <= 4 )); then
- if grep -q 'spam acl condition' /var/log/exim4/paniclog; then
+ if grep -q 'spam acl condition' /var/log/exim4/paniclog &>/dev/null; then
printf . >>$loglog
fi
/a/bin/distro-setup/epanic-clean
fi
}
+# use this if we want to do something just once per minute
first_chars=()
power=true
power=false
fi
-if $power; then
- for h in tp.b8.nz vpn1 x2 x3.b8.nz frodo.b8.nz kd.b8.nz kw; do
- if [[ $HOSTNAME == ${h%%.*} ]]; then
- continue
- fi
- msg=
- if c=$(timeout 1 ssh $h exim -bpc 2>/dev/null) && [[ $c && $c != 0 ]]; then
- msg=q:$h=$c
- first_chars+=($msg)
- fi
- if [[ $1 ]]; then
- echo q: $h $c
- fi
- lo -1 remote-mailq $msg
- done
-fi
write-status
if [[ $1 ]]; then
cat $status_file