Last active
December 17, 2015 17:49
-
-
Save mortymacs/5648269 to your computer and use it in GitHub Desktop.
This is simple bash script for counting MySQL queries.
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 | |
echo -e 'Id | Queries' | |
echo '-------------' | |
i=0 | |
while [ $i -lt 10 ] | |
do | |
a=$(mysql -uroot -p1234 -e "show status like 'Queries'" | tail -1 | awk '{print $2}') | |
sleep 1 | |
b=$(mysql -uroot -p1234 -e "show status like 'Queries'" | tail -1 | awk '{print $2}') | |
result=$[b-a] | |
echo $[i+1] ' | ' $result | |
echo '-------------' | |
let i=i+1 | |
done | |
echo "Finished" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment