Skip to content

Instantly share code, notes, and snippets.

@dotob
Created May 16, 2016 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dotob/5164785c9e1ba218d2b1de1c9c9bb60c to your computer and use it in GitHub Desktop.
Save dotob/5164785c9e1ba218d2b1de1c9c9bb60c to your computer and use it in GitHub Desktop.
small script to check if mysql is running and restart it if not
echo "check mysql"
service mysql status | grep -qE [0-9]{5}
if [ $? -eq 0 ]; then
echo OK
else
service mysql start
echo "-" | mail -s "fringshaus.de mysql restarted" -r sk@dotob.de sk@dotob.de
echo "mysql restarted, mail sent"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment