check_service() { SERVICE=1 nslookup www.somesite.com ip.of.bind.machine | grep "connection timed out" >/dev/null 2>&1 if [ $? -eq 0 ]; then SERVICE=0;fi if [ $SERVICE -eq 0 ]; then echo "NAMED NOT OK - Server appears to be down" exitstatus=$STATE_CRITICAL exit $exitstatus fi } check_service echo "NAMED OK - Everything running like it should" exitstatus=$STATE_OK exit $exitstatus