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
#fi
fi
rm -f $resultfile
+ unexpected=$(( unexpected + ${#results[@]} + ${#missing[@]} ))
fi # if spamdpid
fi # if $slow
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
}
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
}