#!/bin/bash
QUE=`rabbitmqctl list_queues messages_ready name durable|grep -v "^Listing" |grep -v "^Timeout"`
echo "$QUE" | while read line
do
ready=`echo "$line" | awk -F' ' '{print $1}'`
name=`echo "$line" | awk -F' ' '{print $2}'`
durable=`echo "$line" | awk -F' ' '{print $3}'`
if (( "$ready" >= 1000 )) && (( "$durable" == true ));then
echo "--------------"
rabbitmqadmin -q delete queue name="$name" && echo "删除队列超多10000:成功!"
fi
done
05-28 13:25