fixes
authorIan Kelling <ian@iankelling.org>
Tue, 10 May 2022 18:31:45 +0000 (14:31 -0400)
committerIan Kelling <ian@iankelling.org>
Tue, 10 May 2022 18:31:45 +0000 (14:31 -0400)
machine_specific/bitfolk/filesystem/etc/unbound/unbound.conf.d/ian.conf
mailtest-check

index b31ed346eda855374c8f521b2c5a3ac1f800c78c..5b1cfeff0fe3511512c5823a4b25cd1fc1c79483 100644 (file)
@@ -9,7 +9,12 @@ server:
 #log-tag-queryreply: yes
 #log-servfail: yes
 #val-log-level: 1
-verbosity: 4
+
+## This is very verbose, fills up 4g of logs in 8 hours on bk.b8.nz. I think
+## it leads to spamassassin dns timeout (1 second) when the system first
+## starts.
+#verbosity: 4
+#
 
 interface: 127.0.0.1
 interface: ::1
index 5cf79fe8278b8ae69532ee66fb17b60e49ac793a..89ed00c1cd54e10f51e31d4c784ab2f7e2e78f6f 100755 (executable)
@@ -131,13 +131,14 @@ EOF
       fi
       # webmail sends them to cur it seems
       while read -r file; do
-        if [[ $file -nt $latest ]]; then
+        file_sec=$(awk '/^Subject: / {print $4}' $file)
+        if [[ $file_sec ]] && (( file_sec > last_sec )); then
           latest=$file
+          last_sec="$file_sec"
         fi
       done <$tmpfile
 
       to=$(awk '/^Envelope-to: / {print $2}' $latest)
-      last_sec=$(awk '/^Subject: / {print $4}' $latest)
 
       if $slow; then
         if ! $int; then
@@ -236,6 +237,7 @@ EOF
             #fi
           fi
           rm -f $resultfile
+          unexpected=$(( unexpected + ${#results[@]} + ${#missing[@]} ))
         fi # if spamdpid
       fi # if $slow
 
@@ -247,9 +249,8 @@ EOF
       pr <<EOF
 mailtest_check_last_usec{folder="$folder",from="$from"} $last_sec
 EOF
-    done
-    unexpected=$(( unexpected + ${#results[@]} + ${#missing[@]} ))
-  done
+    done # end for from in ${froms[@]}
+  done # end for folder in ${folders[@]}
   if $slow; then
     pr <<EOF
 mailtest_check_unexpected_spamd_results $unexpected
@@ -264,10 +265,13 @@ EOF
 }
 
 loop-main() {
+  # When running under systemd, the system just started. Ve nice and
+  # give programs some time to finish their startup.
+  sleep 5
   while true; do
     premain_sec=$EPOCHSECONDS
     main
-    sleep $(( 300 - ( $EPOCHSECONDS - premain_sec ) ))
+    sleep $(( 300 - ( EPOCHSECONDS - premain_sec ) ))
   done
 }