#!/bin/bash FILE=/var/run/bind/named_test_$1 case $1 in 192.*) HOST=myth.svh.merlins.org IP=192.168.205.61 ;; *) fping -q -r4 -B3 $1 || exit HOST=www.merlins.org IP=209.81.13.136 ;; esac host $HOST $1 &> $FILE if ! grep -q $IP $FILE; then cat $FILE | Mail -s "DNS server $1 does not work" mail_notice@209.81.13.136 fi