#!/bin/bash
##
if [ "$1" == "" ]
then
echo "============================================================="
echo "Erro !!! Do it like this:"
echo "sh script domain-list-file "
echo "============================================================="
exit
fi
##
DATE=`date +%Y%d%m`
##
rm -f /tmp/report*.csv
##
function resolv()
{
domain_src=$1
while read line_name
do
con=`/usr/bin/dig @8.8.8.8 $line_name |grep "CNAME"|awk '$5~/chinacache|ccgslb|lxsvc\.cn|c3cdn\.net|a\.speedupchina\.net|lxsvc\.cn/{print $5}'
#echo $con >> /tmp/report-$DATE.csv
if [ ! "$con" == "" ]
then
echo $line_name >> /tmp/report-$DATE.csv
fi
done < $domain_src
}
##
resolv $1
##
echo "report is /tmp/report-$DATE.csv"