Last active
April 1, 2021 17:58
-
-
Save emilcarr/fd912bdfedd9121d7ca2bbafc389e612 to your computer and use it in GitHub Desktop.
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 | |
# /etc/cron.d/mysql_watch_online | |
# Test the database connection and restart on failure | |
mysql -e '\q' | |
if [ $? != 0 ]; then | |
echo `systemctl status mysql` | mail -s "MySQL Databse experience issues | `hostname`" your@email.com | |
systemctl restart mysql | |
fi |
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
# Execute every 5 minutes | |
*/5 * * * * /etc/cron.d/mysql_watch_online |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment