Last active
August 29, 2015 14:24
-
-
Save lukaszkorecki/db6dcf36dd5377c47a22 to your computer and use it in GitHub Desktop.
Delete all queues from rabbit mq vhost without restarting the server
This file contains hidden or 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
#!/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