some fixes, and dns debugging on bk
[distro-setup] / system-status
index 3ccde7c023e1fb06017a24b5a9c3d7a627d4cc6a..fc04445f02a067717b13a917ecf0ec6e187e9875 100755 (executable)
@@ -46,6 +46,12 @@ loday() {
     /usr/local/bin/log-once "$@" | ifne mail -s "$HOSTNAME: system-status $2" daylert@iankelling.org
   fi
 }
+# rm glob
+rmg() {
+  if (( $# )); then
+    rm -f "$@"
+  fi
+}
 
 # todo, consider migrating some of these alerts into prometheus
 write-status() {
@@ -177,7 +183,10 @@ write-status() {
     #     fi
     #   fi
     # fi
-
+  else # end if $MAIL_HOST
+    rmg /home/iank/cron-errors/bounce* \
+        /home/iank/cron-errors/btrbk.timer* \
+        /home/iank/cron-errors/old-snapshot*
   fi
 
   if ip l show tunfsf &>/dev/null; then
@@ -200,7 +209,7 @@ write-status() {
   if [[ ! $last_emacs_check || $emacsfiles ]] || (( last_emacs_check < EPOCHSECONDS - 300 )); then
     if pgrep -G iank -u iank -f 'emacs --daemon' &>/dev/null; then
       # i dun care if this fails
-      emacsfiles="$(timeout 1 emacsclient --eval "$elisp"| sed '/^"nil"$/d;s/^"(/E: /;s/)"$//' ||:)"
+      emacsfiles="$(timeout 1 emacsclient -a /usr/bin/true --eval "$elisp" 2>/dev/null | sed '/^"nil"$/d;s/^"(/E: /;s/)"$//' ||:)"
       if [[ $emacsfiles ]]; then
         chars+=("$emacsfiles")
       fi
@@ -233,6 +242,9 @@ write-status() {
     $MAIL_HOST)
       p $qmsg | loday -120 qlen
       ;;
+    *)
+      rmg /home/iank/cron-errors/qlen*
+      ;;
   esac
 
   begin=false