Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mtop.sh - mysql top
#!/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
You can’t perform that action at this time.