Here's the script I'm running from cron both inside AWS and outside it at one minute past the hour (with our internal DNS domain replaced with example.com):
#!/bin/bash
tf=/tmp/out.$$
for turn in $(yes | head -60); do
start=$(date)
if ! host $(uuidgen).example.com 2>&1 | tee $tf | grep -q -s -w NXDOMAIN
then
end=$(date)
echo "$cmd failed from $start to $end:"
cat $tf
fi
sleep 1
done
rm -f $tf
Comments
Here's the script I'm running from cron both inside AWS and outside it at one minute past the hour (with our internal DNS domain replaced with example.com):