Created
February 1, 2015 10:09
-
-
Save JulienBlancher/a66e89cc1c790b99cf2f to your computer and use it in GitHub Desktop.
Server Checker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" [email protected] | |
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" [email protected] | |
else | |
echo "Mysql is alive" >> /var/log/serv_check | |
fi | |
echo "----------End Of Check-----------" >> /var/log/serv_check |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
now we use Newrelic 😃