Created
August 13, 2014 12:44
-
-
Save avovsya/60c04018bcf999b6a32d to your computer and use it in GitHub Desktop.
Script to delete RabbitMQ queues by pattern. Took from http://stackoverflow.com/a/18785918/1130863
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
for word in "$@" | |
do | |
args=true | |
newQueues=$(rabbitmqctl list_queues name | grep "$word") | |
queues="$queues | |
$newQueues" | |
done | |
if [ $# -eq 0 ]; then | |
queues=$(rabbitmqctl list_queues name | grep -v "\.\.\.") | |
fi | |
queues=$(echo "$queues" | sed '/^[[:space:]]*$/d') | |
if [ "x$queues" == "x" ]; then | |
echo "No queues to delete, giving up." | |
exit 0 | |
fi | |
read -p "Deleting the following queues: | |
${queues} | |
[CTRL+C quit | ENTER proceed] | |
" | |
while read -r line; do | |
rabbitmqadmin delete queue name="$line" | |
done <<< "$queues" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment