Skip to content

Instantly share code, notes, and snippets.

@lukaszkorecki
Last active August 29, 2015 14:24
Show Gist options
  • Save lukaszkorecki/db6dcf36dd5377c47a22 to your computer and use it in GitHub Desktop.
Save lukaszkorecki/db6dcf36dd5377c47a22 to your computer and use it in GitHub Desktop.
Delete all queues from rabbit mq vhost without restarting the server
#!/usr/bin/env bash
# Before using:
# export RABBIT_USER=<user>
# export RABBIT_PASSWORD=<password>
# export RABBIT_VHOST=<vhost, most likely / or /main>
pw=$RABBIT_PASSWORD
lo=$RABBIT_USER
vh=$RABBIT_VHOST
if [[ -e ./rabbitmqadmin ]] ; then
echo "Got the script already"
else
curl localhost:15672/cli/rabbitmqadmin > rabbitmqadmin
chmod +x rabbitmqadmin
fi
cmd="./rabbitmqadmin --username=$lo --password=$pw --vhost=$vh"
$cmd list queues name | awk '/_/ { print $2 }' | xargs -I'{}' $cmd delete queue name='{}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment