Skip to content

Instantly share code, notes, and snippets.

@mortymacs
Last active December 17, 2015 17:49
Show Gist options
  • Save mortymacs/5648269 to your computer and use it in GitHub Desktop.
Save mortymacs/5648269 to your computer and use it in GitHub Desktop.
This is simple bash script for counting MySQL queries.
#!/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