+ Post New Thread
Results 1 to 6 of 6
*nix Thread, cmd scripts , recording stuff? in Technical; what I know about whatever the linux equivalent of batch would fit on the head of a pin, I need ...
  1. #1
    browolf's Avatar
    Join Date
    Jun 2005
    Location
    Mars
    Posts
    1,540
    Thank Post
    112
    Thanked 89 Times in 75 Posts
    Blog Entries
    47
    Rep Power
    41

    cmd scripts , recording stuff?

    what I know about whatever the linux equivalent of batch would fit on the head of a pin,

    I need a quick script to repeat and record the query time on dig queries in a file and echo it to the screen. , like once a minute, its the most reliable way I can see of recording and mesuring the latency/packet loss on our internet connection.

    can you make dig bypass local dns? when our internet connection is "having problems" a manual query to an new domain jumps to around 2500ms
    local queries are 6ms, normal query time to new dom is 40-150ms

    anyone can write this for me please? thx

  2. #2


    Join Date
    Feb 2007
    Location
    Northamptonshire
    Posts
    4,706
    Thank Post
    354
    Thanked 807 Times in 722 Posts
    Rep Power
    348
    Short answer, yes you can tell dig to use any DNS server you wish.

    dig @dnsserver domainname | grep "Query Time"

    That'll return the time taken for the request but I suppose if you had a list of domains we'd be able to have it return the name of the domain in question and the time taken for the query.

    To be honest though, 40ms is a long old time for an external resolution letalone 150ms! I'm averaging around 24ms here (when testing what I put above) .

  3. #3

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    Boston, MA
    Posts
    7,601
    Thank Post
    110
    Thanked 771 Times in 599 Posts
    Rep Power
    183
    @kmount: I think you have a typo

    The command is dig @dnsserver domainname | grep "Query time" (lowercase 't')

    I get between 5 and 20 msec.

  4. #4

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,867
    Thank Post
    412
    Thanked 778 Times in 651 Posts
    Rep Power
    182
    Quote Originally Posted by Ric_ View Post
    @kmount: I think you have a typo

    The command is dig @dnsserver domainname | grep "Query time" (lowercase 't')

    I get between 5 and 20 msec.
    or use case-insensitive grep: dig@dnsserver domainname | grep -i "QuErY TimE"

  5. #5

    Join Date
    Apr 2006
    Posts
    138
    Thank Post
    0
    Thanked 19 Times in 10 Posts
    Rep Power
    38
    I would do something like
    Code:
    while (true) ; do
    dig whatever | tee -a /tmp/some_logfile
    sleep 60
    done

  6. #6

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,867
    Thank Post
    412
    Thanked 778 Times in 651 Posts
    Rep Power
    182
    I would put this in a cron job every minute (much neater, survives reboots):

    Code:
    * * * * * dig {your query} | grep -i "query time" >> /var/log/dig.log



SHARE:
+ Post New Thread

Similar Threads

  1. Free Stuff (Inc. stuff for teachers)
    By stephenleak in forum General Chat
    Replies: 0
    Last Post: 11th September 2008, 03:44 PM
  2. Help running scripts within scripts
    By SimpleSi in forum *nix
    Replies: 7
    Last Post: 7th March 2008, 10:23 AM
  3. eletrical and eletronic stuff including education stuff
    By alonebfg in forum Recommended Suppliers
    Replies: 0
    Last Post: 28th June 2007, 07:32 AM
  4. Screen Recording
    By alonebfg in forum Windows
    Replies: 7
    Last Post: 28th May 2007, 11:34 PM
  5. Stuff working and stuff still broke.
    By Dos_Box in forum Comments and Suggestions
    Replies: 1
    Last Post: 29th June 2005, 11:48 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •