X-Git-Url: https://git.madduck.net/etc/mailfilter.git/blobdiff_plain/638a5556b1da40dfed06a501546ee46a07974bce..20ed176efc99132a724682c2b29e16756fe40c38:/bin/retrain

diff --git a/bin/retrain b/bin/retrain
index 8135509..b1ccca1 100755
--- a/bin/retrain
+++ b/bin/retrain
@@ -4,7 +4,7 @@ set -eu
 NICE='/usr/bin/nice -20'
 NICE=''
 
-PROCMAIL="$NICE $HOME/.etc/mailfilter/procmail/procmailrc"
+RESUBMIT="$NICE $HOME/.etc/mailfilter/bin/resubmit"
 
 PAUSETIME=10
 
@@ -52,9 +52,13 @@ if ! lockfile -0 -r0 -l 3600 "$LOCKFILE" 2>/dev/null; then
 fi
 
 find $MAILDIR/cur $MAILDIR/new -type f | while read msg; do
-  $NICE ${0%/*}/train $ARG "$msg" | $PROCMAIL || ret=$?
+  $NICE ${0%/*}/train $ARG "$msg" | $RESUBMIT || ret=$?
   case "${ret:-0}" in
     0|75) :;;
+    *)
+      echo "E: resubmission returned with exit code $ret" >&2
+      continue
+      ;;
   esac
   rm -f "$msg"
   sleep $PAUSETIME