Created
September 28, 2016 19:55
-
-
Save ataliba/4661482fce10d34174658c0a09c6e52a 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/sh | |
# | |
# Mysql-test | |
# A little script to test if you mysql or mariadb is running. | |
# If the database is up, only logs, if the database is down, the script starts the database again | |
# Test on a Ubuntu Server | |
# | |
# Author: Ataliba Teixeira | |
# | |
######################################################################### | |
mysqladmin ping > /dev/null 2>&1 && up=1 || up=0 | |
if [ $up -eq 0 ] ; then | |
/sbin/systemctl restart mysql.service | |
/usr/bin/logger -t Mysql-test "O mysql estava parado e foi reiniciado" | |
else | |
/usr/bin/logger -t Mysql-test "O mysql esta rodando" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment