Created
July 17, 2013 06:59
-
-
Save XayOn/6018244 to your computer and use it in GitHub Desktop.
mysl checker
This file contains hidden or 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 | |
# This is for clarity on this example, usually for this I'd use directly $1 $2 $3 in the mysql call | |
user=$1; | |
pass=$2; | |
host=$3; | |
echo "select * from users limit 1" | mysql -u$user -p$pass $db || { | |
mail -s "El servidor mysql se ha caido" [email protected] <<< "Mysql ha fallado a fecha `date`" | |
echo "show processlist" | mysql -u$user -p$pass $db > /var/log/mysql_ps_crashlog_`date +%m-%d-%y_%H_%M`.log | |
} | |
sleep 1m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment