Skip to content

Instantly share code, notes, and snippets.

@zeus911
Forked from mheadd/monitor.sh
Created May 4, 2018 03:11
Show Gist options
  • Select an option

  • Save zeus911/3d541cc3d1df2724341c74b40f346163 to your computer and use it in GitHub Desktop.

Select an option

Save zeus911/3d541cc3d1df2724341c74b40f346163 to your computer and use it in GitHub Desktop.
Simple bash script to check whether MySQL is running.
#!/bin/bash
UP=$(pgrep mysql | wc -l);
if [ "$UP" -ne 1 ];
then
echo "MySQL is down.";
sudo service mysql start
else
echo "All is well.";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment