Created
April 25, 2015 00:26
-
-
Save KhanMaytok/ccb590e92492591b41e6 to your computer and use it in GitHub Desktop.
Restart mysql server if it is down
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 | |
UP=$(service mysql status|grep 'mysql start/running' | wc -l); | |
if [ "$UP" -ne 1 ]; | |
then | |
echo "MySQL is down."; | |
sudo service mysql start; | |
echo "MySQL has return"; | |
else | |
echo "All is well."; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment