Hello,
I find the below works well with one line:
sendmail -Mrm `sendmail -bp | grep "*** frozen ***" | cut -b10-27`
sendmail is a symbolic link to Exim.
> #!/bin/sh
>
> # Clean an exim queue of frozen bounce messages.
> # Usage: $0 [address] [nofreeze]
>
> # If an [address] option is given it is used as a regexp to match against the
> # sender of the addresses to remove
>
> # If the [nofreeze] option is given (can be any string) then the
> # mail doesn't have to be frozen. Use with care.
>
> PATH=/usr/local/sbin:/usr/xpg4/bin:/usr/local/bin:$PATH
>
> if [ -n "$2" ]; then
> fr="$2"
> else
> fr=' \*\*\* frozen \*\*\*'
> fi
>
> # if you have a version of exim too old to use the r option, remove it.
> /usr/local/exim/bin/exim -bpru | \
> awk 'BEGIN {
> rmfunct="/usr/local/exim/bin/exim -Mrm "
> }
>
> /^ ?[0-9].*<'"$1"'>'"$fr"'$/ {
> rmlist= rmlist " " $3; ++num
> if (num > 50) {
> if (system(rmfunct rmlist ">/dev/null") !=0) {
> print "Call to " rmfunct " " rmlist " failed."
> } else {
> total+=num; num=0; rmlist=""
> }
> }
> }
>
> END {
> if (num > 0) {
> if (system(rmfunct rmlist ">/dev/null") !=0) {
> print "Call to " rmfunct " " rmlist " failed."
> } else {
> total+=num
> }
> }
> if (total > 0) {
> print total " message[s] removed."
> }
> }'
>
>
> --
>
> ## List details at http://www.exim.org/mailman/listinfo/exim-users Exim details at http://www.exim.org/ ##
>
> --- [ Tanaya/Exim/Antiviral ] ---
> This message has been scanned with INOCULATE, H+BEDV AntiVir, and F-PROT
> antivirus software and has been determined to be VIRUS FREE.
>
>
--- [ Tanaya/Exim/Antiviral ] ---
This message has been scanned with INOCULATE, H+BEDV AntiVir, and F-PROT
antivirus software and has been determined to be VIRUS FREE.