+ 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,364
    Blog Entries
    36
    Thank Post
    73
    Thanked 76 Times in 63 Posts
    Rep Power
    30

    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,411
    Thank Post
    322
    Thanked 715 Times in 644 Posts
    Rep Power
    199
    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
    London
    Posts
    7,603
    Thank Post
    96
    Thanked 678 Times in 523 Posts
    Rep Power
    156
    @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,852
    Thank Post
    412
    Thanked 773 Times in 646 Posts
    Rep Power
    168
    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
    139
    Thank Post
    0
    Thanked 19 Times in 10 Posts
    Rep Power
    32
    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,852
    Thank Post
    412
    Thanked 773 Times in 646 Posts
    Rep Power
    168
    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, 02: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, 06:32 AM
  4. Screen Recording
    By alonebfg in forum Windows
    Replies: 7
    Last Post: 28th May 2007, 10:34 PM
  5. Stuff working and stuff still broke.
    By Dos_Box in forum Comments and Suggestions
    Replies: 1
    Last Post: 29th June 2005, 10: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
  •