Skip to content

Instantly share code, notes, and snippets.

@thiagooak
Created December 13, 2013 12:11
Show Gist options
  • Save thiagooak/7943393 to your computer and use it in GitHub Desktop.
Save thiagooak/7943393 to your computer and use it in GitHub Desktop.
kill ALL rabbitmq connections
rabbitmqctl list_connections pid port state user vhost recv_cnt send_cnt send_pend name | awk '{print "rabbitmqctl close_connection \"" $1 "\" \"manually closing idle connection\"" | "/bin/bash" }'
@olivertappin
Copy link

olivertappin commented Oct 14, 2019

This command also added the Listing connections ... line as:

rabbitmqctl close_connection "Listing" "manually closing idle connection"

I slightly changed it to this instead, which seems more resilient:

sudo rabbitmqctl list_connections pid port state user vhost recv_cnt send_cnt send_pend name \
 | grep -vP 'Listing|pid' \
 | awk '{print "rabbitmqctl close_connection \"" $1 "\" \"manually closing idle connection\"" }' \
 | sudo sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment