Skip to content

Instantly share code, notes, and snippets.

@XayOn
Created July 17, 2013 06:59
Show Gist options
  • Save XayOn/6018244 to your computer and use it in GitHub Desktop.
Save XayOn/6018244 to your computer and use it in GitHub Desktop.
mysl checker
#!/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