-
-
Save pbrilius/f9fb9237a4388454c9be9f9a189cf311 to your computer and use it in GitHub Desktop.
mtop.sh - mysql top
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 | |
if [ ! -z $1 ]; then | |
export MTOPU="-uroot" | |
export MTOPPW="-p$1" | |
fi | |
if [ -f /root/.my.cnf ]; then | |
MTOPU=' ' | |
MTOPPW=' ' | |
fi | |
if [ -z $MTOPU ] && [ -z $MTOPPW] && [ $MTOPU != ' ' ]; then | |
echo "User/Password!!" | |
read -p 'user:' us | |
read -s -p 'pw:' pw | |
export MTOPU="-u${us}" | |
export MTOPPW="-p${pw}" | |
# exit; | |
fi | |
clear; | |
watch "top -b | head; mysqladmin -u $MTOPU -p$MTOPPW status;echo; mysqladmin $MTOPU $MTOPPW processlist | head -20" | |
exit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment