Created
April 13, 2017 05:34
-
-
Save halgatewood/7078782887df33e2c8e3b625881c36de to your computer and use it in GitHub Desktop.
Crontab: * * * * * /bin/bash /var/relaunch.sh
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 | |
LOGFILE="/var/crons.log" | |
UP=$(pgrep mysql | wc -l); | |
if [ "$UP" -ne 1 ]; | |
then | |
echo "restarting mysql at $(date)" >> $LOGFILE | |
sudo service mysql restart | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment