Skip to content

Instantly share code, notes, and snippets.

@dwelch2344
Created June 29, 2015 05:59
Show Gist options
  • Select an option

  • Save dwelch2344/6544e70abf08e6627237 to your computer and use it in GitHub Desktop.

Select an option

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 no-reply@yourEmail.com -t whoever@needsToKnow.com -u subject -m "Restarted MySQL on ng-ocean" -s smtp.gmail.com -o tls=yes -xu your@gmail.com -xp "yourGmailPassword"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment