]> git.madduck.net Git - etc/mailfilter.git/blob - bin/process-delayed-queue

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

fix resubmit script
[etc/mailfilter.git] / bin / process-delayed-queue
1 #!/bin/sh
2 set -eu
4 MAILDIR=$HOME/.maildir
6 SQLITE=/usr/bin/sqlite3
7 RESUBMIT=$HOME/.etc/mailfilter/bin/resubmit
9 DELAYED_QUEUE_DB=$VAR/procmail/delayed-queue.sqlite
11 QUERY='select * from messages where release_ts < strftime("%s", "now")'
13 $SQLITE -column $DELAYED_QUEUE_DB "$QUERY" | while read msgid file ts; do
14   file="$MAILDIR/$file"
15   if [ ! -f "$file" ]; then
16     echo "E: message $msgid not found in $file" >&2
17   else
18     $RESUBMIT "$file"
19     echo "I: resubmitted $msgid"
20   fi
21   $SQLITE $DELAYED_QUEUE_DB "delete from messages where msgid = '$msgid'"
22 done