Skip to content

Instantly share code, notes, and snippets.

@JulienBlancher
Created February 1, 2015 10:09
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 JulienBlancher/a66e89cc1c790b99cf2f to your computer and use it in GitHub Desktop.
Save JulienBlancher/a66e89cc1c790b99cf2f to your computer and use it in GitHub Desktop.
Server Checker
#!/bin/bash
echo "---------Start Of Check----------" >> /var/log/serv_check
echo "Check of server availability started at `date +%D-%T`" >> /var/log/serv_check
if ! pgrep -x apache2 > /dev/null
then
echo "Apache is NOT alive !" >> /var/log/serv_check
echo "Apache is NOT alive !" | mail -s "[`date +%D-%T`] APACHE CRITICAL ERROR" ju.blancher@gmail.com
else
echo "Apache is alive" >> /var/log/serv_check
fi
if ! pgrep -x mysqld > /dev/null
then
echo "Mysqld is NOT alive !" >> /var/log/serv_check
echo "Mysqld is NOT alive !" | mail -s "[`date +%D-%T`] MYSQL CRITICAL ERROR" ju.blancher@gmail.com
else
echo "Mysql is alive" >> /var/log/serv_check
fi
echo "----------End Of Check-----------" >> /var/log/serv_check
@JulienBlancher
Copy link
Author

now we use Newrelic 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment