Skip to content

Instantly share code, notes, and snippets.

@dwelch2344
Created June 29, 2015 05:59
Show Gist options
  • Save dwelch2344/6544e70abf08e6627237 to your computer and use it in GitHub Desktop.
Save dwelch2344/6544e70abf08e6627237 to your computer and use it in GitHub Desktop.
Simple script to run in cron for resetting services
#!/bin/bash
PATH=/usr/sbin:/usr/bin:/sbin:/bin
if [[ ! "$(/usr/sbin/service mysql status)" =~ "start/running" ]]
then
/usr/sbin/service mysql start
sendemail -f [email protected] -t [email protected] -u subject -m "Restarted MySQL on ng-ocean" -s smtp.gmail.com -o tls=yes -xu [email protected] -xp "yourGmailPassword"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment