Created
October 4, 2013 13:44
-
-
Save puentesdiaz/6826144 to your computer and use it in GitHub Desktop.
Verify if a Mysql Service are running, if not then restart it
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/sh | |
#chmod a+x /usr/local/bin/verificarServers.sh | |
#crontab -e | |
#0,15,30,45 * * * * /usr/local/bin/verificarServers.sh | |
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin | |
SERVICE='mysqld' | |
if ps ax | grep -v grep | grep $SERVICE > /dev/null | |
then | |
service mysql status > /dev/null | |
# mkdir /var/log/statusMysqlOK/$(($(date +%s%N)/1000000)) | |
else | |
service mysql restart > /dev/null | |
# mkdir /var/log/statusMysqlDOWN/$(($(date +%s%N)/1000000)) | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment