X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=system-status;h=28c00358255ee79f652587c090e55912a6c8e8df;hb=b18dade73dedfe69aa741f8417947d83c4208f2d;hp=051de623df85e046d22a01f7d810b2e597f42578;hpb=2b981100a8b45f117d6f5c165404937f3c917e8f;p=distro-setup diff --git a/system-status b/system-status index 051de62..28c0035 100644 --- a/system-status +++ b/system-status @@ -2,8 +2,8 @@ # Copyright (C) 2019 Ian Kelling # SPDX-License-Identifier: AGPL-3.0-or-later -# usage: runs 4 times every 15 seconds unless any args are passed, or we -# are on battery power, then just runs once. +# usage: runs once every 15 seconds unless any args are passed, or we +# then just runs once. On battery power, run once per minute. if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi @@ -33,6 +33,11 @@ lo() { /usr/local/bin/log-once "$@" | ifne mail -s "$HOSTNAME: system-status $2" root@localhost } +loday() { + /usr/local/bin/log-once "$@" | ifne mail -s "$HOSTNAME: system-status $2" daylerts@iankelling.org +} + + write-status() { chars=("${first_chars[@]}") @@ -83,19 +88,26 @@ write-status() { if [[ $(find /var/mail -type f \! -empty -print -quit) ]]; then var_mail_msg="message in /var/mail" fi - lo -1 var_mail $var_mail_msg + loday -1 var_mail $var_mail_msg glob=(/m/md/bounces/new/*) if [[ -e ${glob[0]} ]]; then chars+=("BOUNCE") bouncemsg="message in /m/md/bounces/new" fi - lo -1 bounce $bouncemsg + loday -1 bounce $bouncemsg # emails without the S (seen) flag. this only checks the last flag, # but its good enough for me. glob=(/m/md/alerts/{new,cur}/!(*,S)) if [[ -e ${glob[0]} ]]; then chars+=("A") fi + + glob=(/m/md/daylerts/{new,cur}/!(*,S)) + if [[ -e ${glob[0]} ]]; then + chars+=("L") + fi + + tmp=(/var/local/cron-errors/mailtest-check*) if (( ${#tmp[@]} )); then chars+=("MAILPING") @@ -105,8 +117,9 @@ write-status() { chars+=("SPAMD") fi - # early in install process, we dont have permission yet for exiqgrep - qlen=$(/usr/sbin/exiqgrep -o 600 -c -b | awk '{print $1}') ||: + # early in install process, we dont have permission yet for exiqgrep. + # 1100 helps allow for system restarts + qlen=$(/usr/sbin/exiqgrep -o 1100 -c -b | awk '{print $1}') ||: if ((qlen)); then qmsg="queue length $qlen" chars+=("q $qlen") @@ -115,7 +128,7 @@ write-status() { # No point in emailing about the mailq on a host where we don't # check email. $MAIL_HOST|bk) - lo -120 qlen $qmsg + loday -120 qlen $qmsg ;; esac @@ -213,7 +226,7 @@ write-status() { chars+=("BTRBK.TIMER") bbkmsg="btrbk.timer not enabled" fi - lo -960 btrbk.timer $bbkmsg + lo -48 btrbk.timer $bbkmsg ## check if last snapshot was within an hour vol=o @@ -258,10 +271,6 @@ write-status() { # use this if we want to do something just once per minute first_chars=() -power=true -if [[ -e /sys/class/power_supply/AC/online && $(