#!/bin/sh # # qbonkfrom # John Simpson # 2007-02-17 # # Finds messages in a qmail queue where the sender contains a certain # regex, and "touches" them with a really old timestamp so that qmail-send # will delete the message after one more delivery attempt. # ############################################################################### # # Copyright (C) 2003-2007 John Simpson. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # or visit http://www.gnu.org/licenses/gpl.txt # ############################################################################### VQ="/var/qmail" NL=`mktemp -t -p /tmp nlist.XXXXXXXXXXXX` || exit 1 find $VQ/queue/info -type f -print0 \ | xargs -0 grep -l "${1:?No pattern specified}" \ | sed 's/^.*\///' > $NL for n in `cat "$NL"` do echo Bonking message $n touch -ct 199801010000 /var/qmail/queue/info/*/$n done rm "$NL"