Skip to content

Instantly share code, notes, and snippets.

@CMDann
Created April 12, 2014 20:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CMDann/10555826 to your computer and use it in GitHub Desktop.
Save CMDann/10555826 to your computer and use it in GitHub Desktop.
Cron job to check if mysql is running
#!/bin/bash
/usr/bin/mysqladmin ping| grep 'mysqld is alive' > /dev/null 2>&1
if [ $? != 0 ]
then
sudo service mysql restart
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment