Skip to content

Instantly share code, notes, and snippets.

/script.sh Secret

Created May 4, 2017 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save anonymous/a9f51450975912c96572abd9ceabce19 to your computer and use it in GitHub Desktop.
Save anonymous/a9f51450975912c96572abd9ceabce19 to your computer and use it in GitHub Desktop.
#!/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'
@dajon776
Copy link

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

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