From: martin f. krafft Date: Sun, 23 Sep 2007 20:15:34 +0000 (+0200) Subject: script to process the delayed queue X-Git-Url: https://git.madduck.net/etc/mailfilter.git/commitdiff_plain/0e6de930e8c8037587f9843f39a0611f22fd78ca?ds=inline script to process the delayed queue --- diff --git a/bin/process-delayed-queue b/bin/process-delayed-queue new file mode 100755 index 0000000..82818eb --- /dev/null +++ b/bin/process-delayed-queue @@ -0,0 +1,22 @@ +#!/bin/sh +set -eu + +MAILDIR=$HOME/.maildir + +SQLITE=/usr/bin/sqlite3 +RESUBMIT=$HOME/.etc/mailfilter/bin/resubmit + +DELAYED_QUEUE_DB=$VAR/procmail/delayed-queue.sqlite + +QUERY='select * from messages where release_ts < strftime("%s", "now")' + +$SQLITE -column $DELAYED_QUEUE_DB "$QUERY" | while read msgid file ts; do + file="$MAILDIR/$file" + if [ ! -f "$file" ]; then + echo "E: message $msgid not found in $file" >&2 + else + $RESUBMIT "$file" + echo "I: resubmitted $msgid" >&2 + fi + $SQLITE $DELAYED_QUEUE_DB "delete from messages where msgid = '$msgid'" +done