Created
May 3, 2018 05:55
-
-
Save ahgood/de9fcc00f9ccf131f08d53548c6b911f to your computer and use it in GitHub Desktop.
Monitor and restart MySQL
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 | |
if [[ ! "$(/usr/sbin/service mysql status)" =~ "active (running)" ]] | |
then | |
/etc/init.d/mysql stop | |
/etc/init.d/mysql start | |
echo "Restarted." | |
fi | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment