-
-
Save anonymous/a9f51450975912c96572abd9ceabce19 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
set -e | |
set -o pipefail | |
exec sudo ngrep -P ' ' -l -W single -d bond0 -q 'SELECT' 'tcp and dst port 3306' | | |
egrep "\[AP\] .\s*SELECT " | | |
sed -e 's/^T .*\[AP\?\] .\s*SELECT/SELECT/' -e 's/$/;/' | | |
ssh $1 -- 'sudo parallel --recend "\n" -j16 --spreadstdin mysql github_production -f -ss' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
setup the shell environment (set -e and set -o pipefail)
As root (via sudo) execute ngrep (presumably gnu's ngrep) to grab the output of the mysql SQL statement looking for the tcp info on the interface to the DB