X-Git-Url: https://git.madduck.net/etc/mailfilter.git/blobdiff_plain/3a35a72b02f689e9ed9ec92f45f084f761d5c8b5..b9d8d8cd7d90da7e14d72ed0bf6d1054f2ce3f5c:/bin/release-delayed-messages diff --git a/bin/release-delayed-messages b/bin/release-delayed-messages index 6a057c9..7ea142e 100755 --- a/bin/release-delayed-messages +++ b/bin/release-delayed-messages @@ -1,12 +1,19 @@ #!/bin/sh set -eu +exit 0 -MAILDIR=$HOME/.maildir +DELAYED_QUEUE=$HOME/.maildir/.delayed -SQLITE=/usr/bin/sqlite3 -DELAYED_QUEUE_DB=$HOME/.var/procmail/delayed-queue.sqlite +DIR="${0%/*}" -QUERY="update messages set release_ts = strftime('%s', 'now') - 10 where filename like '.delayed/%'" +VAR=$HOME/.var/procmail +ME="${0##*/}" +LOCKFILE="$VAR/.$ME.lock" +trap "rm -f $LOCKFILE" 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15 +if ! lockfile -0 -r0 -l 3600 "$LOCKFILE" 2>/dev/null; then + echo "E: another $ME process is already running over that Maildir." >&2 + exit 1 +fi -$SQLITE $DELAYED_QUEUE_DB "$QUERY" -exec $HOME/.etc/mailfilter/bin/process-delayed-queue +"$DIR"/list-postponed-messages --all "$DELAYED_QUEUE" \ + | exec xargs "$DIR"/resubmit --list