exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | bash
`exim -bp`, lists the messages in queue, which is piped through awk, printing to output "exim -Mrm {MessageID}" which is further piped into bash for execution.
- sandip's blog
- Login or register to post comments
Comments
This works out better if you know the sender email address that needs weeding from the mail queue.
exim -bp | grep "nobody@" | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | bash
or if you need to clean mails older than a couple days from the queue:
exim -bp | grep "^ 3d" | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' |bash
exiqgrep -i | xargs exim -Mrm