various fixes
[distro-setup] / system-status
index 12e0426c3d0519ff6d8ca2323490736d5c1458da..47103ace6129c32dbdaf305cdbc4394e71dc1dd9 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
@@ -219,16 +228,6 @@ write-status() {
   fi
   p $var_mail_msg | loday -1 var_mail
 
-
-  tmp=(/var/local/cron-errors/mailtest-check*)
-  if (( ${#tmp[@]} )); then
-    chars+=(MAILPING)
-  fi
-  tmp=(/var/local/cron-errors/mailtest-slow*)
-  if (( ${#tmp[@]} )); then
-    chars+=(SPAMD)
-  fi
-
   # 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}') ||:
@@ -243,6 +242,9 @@ write-status() {
     $MAIL_HOST)
       p $qmsg | loday -120 qlen
       ;;
+    *)
+      rmg /home/iank/cron-errors/qlen*
+      ;;
   esac
 
   begin=false