Skip to content

Instantly share code, notes, and snippets.

@jrh-spg
Created June 12, 2013 18:51
Show Gist options
  • Save jrh-spg/5768038 to your computer and use it in GitHub Desktop.
Save jrh-spg/5768038 to your computer and use it in GitHub Desktop.
Q&D script for monitoring if named is running locally.
#!/bin/bash
contact=name@domain.tld
host=`ifconfig eth0|grep inet\ addr|cut -d: -f2|awk {'print $1'}`
check=`dig +short @$host localhost|awk {'print $1'}`
if [ $check != 127.0.0.1 ]
then
# Uncomment the next line for testing.
#echo "He's dead, Jim."
service named restart
grep named /var/log/messages|tail -300 |mail -s "Named failed on `hostname`" $contact
else
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment