]> git.madduck.net Git - etc/mailfilter.git/commitdiff

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:

script to process the delayed queue
authormartin f. krafft <madduck@madduck.net>
Sun, 23 Sep 2007 20:15:34 +0000 (22:15 +0200)
committermartin f. krafft <madduck@madduck.net>
Sun, 23 Sep 2007 20:15:34 +0000 (22:15 +0200)
bin/process-delayed-queue [new file with mode: 0755]

diff --git a/bin/process-delayed-queue b/bin/process-delayed-queue
new file mode 100755 (executable)
index 0000000..82818eb
--- /dev/null
@@ -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