#!/bin/sh
time_out=0
querygt3s=0
i=1
while [[ $i -le 15 ]]
do
i=`expr $i + 1`
sleep 2
while read line
do
        start_time=`date +%s`
        query_count=`dig $line +short|wc -l`
        stop_time=`date +%s`
        query_time=`expr $stop_time - $start_time`
        while true 
        do
            if [[ $query_time -gt 2  ]];then
                querygt3s=`expr $querygt3s + 1`
            elif [[ $query_count -eq 0 ]];then
                time_out=`expr $time_out + 1`
            fi
            break
        done
done < /data/etc/dnslist.txt
done
echo `expr $querygt3s + $time_out` > /data/etc/dnscount.txt