#!/bin/sh
#
# qkillns
# John Simpson
#
# *********************************************************************
# *** ***
# *** DANGER! DANGER! DANGER! ***
# *** ***
# *** DO NOT RUN THIS WHILE ANY QMAIL-RELATED PROGRAMS ARE RUNNING! ***
# *** ***
# *** DANGER! DANGER! DANGER! ***
# *** ***
# *********************************************************************
#
# 2005-04-11 jms1 - (no code changed.) changed the copyright notice to
# specify that the license is the GPL VERSION 2 ONLY. i'm not comfortable
# with the "or future versions" clause until i know what these "future
# versions" will look like.
#
# 2006-06-28 jms1 - received an email from John Newman which got me
# thinking about these scripts again. simplifying this one so that
# it should run a bit more quickly.
#
###############################################################################
#
# Copyright (C) 2003-2006 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
#
###############################################################################
for n in `find /var/qmail/queue/info -size 2c | sed 's/.*\///'`
do
echo Killing message $n
rm -f /var/qmail/queue/bounce/$n \
/var/qmail/queue/info/*/$n \
/var/qmail/queue/intd/$n \
/var/qmail/queue/local/*/$n \
/var/qmail/queue/mess/*/$n \
/var/qmail/queue/remote/*/$n \
/var/qmail/queue/todo/$n
done
echo Kicking the queue
qmail-tcpok
killall -ALRM qmail-send