I couldn’t find a script to search the Postfix mail queue so I wrote one. It’s a bash script and can be downloaded here (or just copy and paste it to file of your choice). I call it ssubject.sh. It ends up just spitting out the queue id’s of messages that match. Usage: “ssubject.sh “some words to look for”
-
#!/bin/bash
-
-
SUBJECT=$1
-
-
/usr/sbin/postqueue -p | awk {'print $1'} | grep -v (host | \
-
grep -v @ | grep -v (delivery | grep -v (Host | grep -v (connect | \
-
grep -v (lost | grep -v (conversation | grep -v -Queue | \
-
sed 's/*//g' | sed '/^$/d' > /tmp/queue_ids.txt
-
-
cat /tmp/queue_ids.txt | while read line; do
-
sudo /usr/sbin/postcat -q ${line}|> | grep "$SUBJECT" > /dev/null 2>&1
-
if [ "$?" -eq "0" ]; then
-
echo ${line}|> ;
-
fi
-
done
0 Comments.