X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=system-status;h=c92bc9a9656583b253d5619f8d97b9ddeffe6260;hb=b311e6f6fa930805674d7d53d67cd033fdbf3367;hp=a36240ca24c631296d5d944da3a6d2251ab02c87;hpb=4757c5d037a08795aa5b5081ae9f7449b5cf1ce5;p=distro-setup diff --git a/system-status b/system-status index a36240c..c92bc9a 100755 --- a/system-status +++ b/system-status @@ -6,14 +6,14 @@ if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi -set -eE -o pipefail -trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR - +source /a/bin/errhandle/err status_file=/dev/shm/iank-status shopt -s nullglob shopt -s dotglob +lo() { /usr/local/bin/log-once "$@"; } + write-status() { chars=() @@ -24,8 +24,9 @@ write-status() { glob=(/m/md/bounces/new/*) if [[ -e $glob ]]; then chars+=("BOUNCE!") + lo -1 bounce "message in /m/md/bounces/new" fi - glob=(/m/md/alerts/new/*) + glob=(/m/md/alerts/new/* /m/md/alerts/cur/*) if [[ -e $glob ]]; then chars+=("ALERT!") fi @@ -34,12 +35,14 @@ write-status() { fi if [[ -s /var/log/exim4/paniclog ]]; then chars+=("PANIC!") + tail /var/log/exim4/paniclog | lo -1 paniclog fi source /a/bin/bash_unpublished/source-state if [[ $MAIL_HOST == $HOSTNAME ]]; then if [[ $(systemctl is-active btrbk.timer) != active ]]; then - chars+=("BTRBK-TIMER!") + chars+=("BTRBK.TIMER!") + lo -60 btrbk.timer "btrbk.timer not enabled" fi ## check if last snapshot was within an hour @@ -56,6 +59,7 @@ write-status() { done if (( maxtime < now - 60*60 )); then chars+=("OLD-SNAPSHOT!") + lo -1 old-snapshot "/o snapshot older than 1 hour" fi fi