Skip to content

Instantly share code, notes, and snippets.

@halgatewood
Created April 13, 2017 05:34
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 halgatewood/7078782887df33e2c8e3b625881c36de to your computer and use it in GitHub Desktop.
Save halgatewood/7078782887df33e2c8e3b625881c36de to your computer and use it in GitHub Desktop.
Crontab: * * * * * /bin/bash /var/relaunch.sh
#!/bin/bash
LOGFILE="/var/crons.log"
UP=$(pgrep mysql | wc -l);
if [ "$UP" -ne 1 ];
then
echo "restarting mysql at $(date)" >> $LOGFILE
sudo service mysql restart
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment