Skip to content

Instantly share code, notes, and snippets.

@error454
Created February 6, 2012 19:20
Show Gist options
  • Save error454/1754202 to your computer and use it in GitHub Desktop.
Save error454/1754202 to your computer and use it in GitHub Desktop.
Bash DNS resolution timer
#!/bin/bash
#Sleep interval
S=$1
#filename suffix
suffix="s.log"
while(true)
do
line=`date +"%m-%d-%y %H:%M:%S"`
out=`dig somehost.com | grep Query | gawk -F' ' '{print $4}'`
filename=dnstiming-`date +"%m-%d-%y"`-$S
filename="$filename$suffix"
echo $line $out >> $filename
sleep $S
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment