Last active
June 24, 2017 17:06
-
-
Save mick-shaw/814c21d1ef9e48a27fa6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This script will prompt for sender domain and then purge the mail queue | |
# Requires qtool.pl | |
echo "Type the sender domain you would like to purge, followed by [ENTER]:" | |
read domain | |
echo "Got it. I'll purge all messages from $domain" | |
QIDS="$(mailq | grep -B1 $domain | grep '^[a-z]' | awk '{print $1}' | sed 's/\*$//')" | |
for q in $QIDS | |
do | |
/usr/local/bin/qtool.pl -C /etc/mail/sendmail.cf -d /var/spool/mqueue/$q | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment