whois lookup from script intermittently not working


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting whois lookup from script intermittently not working
# 1  
Old 06-23-2007
whois lookup from script intermittently not working

Hello,

I wrote a basic script to query a whois server using the whois system command to retrieve information about IP's. I have file containing the ip addresses which I feed to the whois command via a while loop. This seems to work sometimes. Most of the time, the whois command seems not to return any data back - it skips many ip's. It is almost if the script runs too quickly for the whois command to return results or to write to the output file??? However I do know that all ip addresses should return data back, since when I run the whois command manually, data is returned on every ip, even the ones that don't return in the script.

I put a sleep command in, but it doesn't help...

So, in other words:
******************************************************************************
[Querying whois.completewhois.com]
[whois.completewhois.com]
******************************************************************************

means that the whois results did not write to the output file.



Here is my script:
-----------------------------------------------------------------
#!/bin/bash

while read ip_address
do
whois -h [some hostname here...] $ip_address >> whois_results
sleep 20

## line separator
echo "***************" >> whois_results

done < unique_ip.list
-----------------------------------------------------------------

And here is whois_results:
-----------------------------------------------------------------
[Querying whois.completewhois.com]
[whois.completewhois.com]
Completewhois.Com Whois Server, Version 0.91a33, compiled on May 28,
2006
Please see http://www.completewhois.com/help.htm for command-line
options
Use of this server and any information obtained here is allowed only
if you follow our policies at http://www.completewhois.com/policies.htm

[IPv4 whois information for 128.194.135.94 ]
[whois.arin.net]

OrgName: Texas A&M University
OrgID: TAMU
Address: Network Services
Address: Computing & Information Services
Address: Mail Stop 3142
City: College Station
StateProv: TX
PostalCode: 77843-3142
Country: US

NetRange: 128.194.0.0 - 128.194.255.255
CIDR: 128.194.0.0/16
NetName: TAMU-NET
NetHandle: NET-128-194-0-0-1
Parent: NET-128-0-0-0-0
NetType: Direct Allocation
NameServer: NS1.TAMU.EDU
NameServer: NS2.TAMU.EDU
NameServer: NS3.TAMU.EDU
NameServer: DNS1.LATECH.EDU
Comment:
RegDate: 1987-01-16
Updated: 2005-09-22

RTechHandle: NG16-ORG-ARIN
RTechName: Network Services
RTechPhone: +1-979-862-2222
RTechEmail: tech@net.tamu.edu

OrgTechHandle: NG16-ORG-ARIN
OrgTechName: Network Services
OrgTechPhone: +1-979-862-2222
OrgTechEmail: tech@net.tamu.edu

# ARIN WHOIS database, last updated 2007-06-22 19:10
# Enter ? for additional hints on searching ARIN's WHOIS database.

******************************************************************************
[Querying whois.completewhois.com]
[whois.completewhois.com]
******************************************************************************
[Querying whois.completewhois.com]
[whois.completewhois.com]
******************************************************************************
[Querying whois.completewhois.com]
[whois.completewhois.com]
******************************************************************************
[Querying whois.completewhois.com]
[whois.completewhois.com]
******************************************************************************
[Querying whois.completewhois.com]
[whois.completewhois.com]
******************************************************************************
[Querying whois.completewhois.com]
[whois.completewhois.com]
******************************************************************************
[Querying whois.completewhois.com]
[whois.completewhois.com]
Completewhois.Com Whois Server, Version 0.91a33, compiled on May 28,
2006
Please see http://www.completewhois.com/help.htm for command-line
options
Use of this server and any information obtained here is allowed only
if you follow our policies at http://www.completewhois.com/policies.htm

[IPv4 whois information for 64.246.165.50 ]
[whois.arin.net]

OrgName: Compass Communications, Inc.
OrgID: CPCM
Address: 2001 6th Avenue
Address: Suite 3205
City: Seattle
StateProv: WA
PostalCode: 98121
Country: US

ReferralServer: rwhois://rwhoisd.ccom.net:4321

NetRange: 64.246.160.0 - 64.246.191.255
CIDR: 64.246.160.0/19
NetName: CCOM-2003
NetHandle: NET-64-246-160-0-1
Parent: NET-64-0-0-0-0
NetType: Direct Allocation
NameServer: NS1.CCOM.NET
NameServer: NS2.CCOM.NET
Comment:
RegDate: 2003-05-16
Updated: 2004-03-10

OrgTechHandle: IC122-ARIN
OrgTechName: COMPASS COMMUNICATIONS, INC.
OrgTechPhone: +1-206-777-9988
OrgTechEmail: hostmaster@ccom.net

# ARIN WHOIS database, last updated 2007-06-22 19:10
# Enter ? for additional hints on searching ARIN's WHOIS database.
[RWHOIS: RWHOISD.CCOM.NET]
error querying rwhois server: Could not connect to host

******************************************************************************
[Querying whois.completewhois.com]
[whois.completewhois.com]
******************************************************************************
[Querying whois.completewhois.com]
[whois.completewhois.com]
******************************************************************************
[Querying whois.completewhois.com]
[whois.completewhois.com]
******************************************************************************
[Querying whois.completewhois.com]
[whois.completewhois.com]
******************************************************************************

Thank you,
Alex
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. What is on Your Mind?

Whois Lookup

Hi. I've just made our internal Whois lookup service available for all forum users, not only moderators and admins. Whois Database It's basically the same whois info you can get from your command line and many other web sites. If you would like to see other features, please post in... (0 Replies)
Discussion started by: Neo
0 Replies

2. Shell Programming and Scripting

Lookup field values in two fixed format file in UNIX - not working

I have 2 fixed length files input#1 & input#2. I want to match the rows based on the value in position 37-50 in both files (pos 37-50 will have same value in both files). If any matching record is found then cut the value against company code & Invoice number from input file #1 (position 99 until... (3 Replies)
Discussion started by: Lingaraju
3 Replies

3. Shell Programming and Scripting

Help on lookup script

Hi All, I've had a look around the forum but cannot find any answers for what I want to do. I have 2 files : FILE 1 =============== ter049107 ter049048 2013-04-09 08:15:16 ter049056 ter049083 ter049112 2013-04-09 10:35:10 2013-04-09 10:29:47 2013-04-09 07:44:05 FILE 2 - note... (4 Replies)
Discussion started by: prashantv
4 Replies

4. Shell Programming and Scripting

lookup script

dear all.. need your help.. i have searching but still didn't find what i need. i have 2 file, i want to lookup one to many, the key is $1 : main.txt code.txt output.txt thanks.. br, herman (2 Replies)
Discussion started by: buncit8
2 Replies

5. UNIX for Advanced & Expert Users

cronjob not working intermittently

Hi there I have a cronjob running on a sol 10 U6 server which runs every 15 minutes. The cronjob is a perl script. But I have noticed that after every few weeks the job stops running all of a sudden. There are other cronjobs running on the system from the same user and from other users which... (3 Replies)
Discussion started by: sinfuldips
3 Replies

6. UNIX for Dummies Questions & Answers

Cronjob for running a php script intermittently?

Hey all Found this forum googling for solutions. Great community this! Im looking for help trying to run a php script every 20 minutes. The script basically has to loop continuously forever but inexplicably hangs every 30 minutes or so. I have not been able to debug the script and find... (2 Replies)
Discussion started by: aras
2 Replies

7. UNIX for Advanced & Expert Users

Network interface goes down intermittently

Hi all, I'm using an HP Proliant server with double NIC and Debian 5 (Lenny) as its OS. I used link bonding on it for several years with no problem. Today, (now only one interface connected to switch) the interface went down. I restarted networking service (/etc/init.d/networking restart) and... (7 Replies)
Discussion started by: mjdousti
7 Replies

8. UNIX for Advanced & Expert Users

Clueless about how to lookup and reverse lookup IP addresses under a file!!.pls help

Write a quick shell snippet to find all of the IPV4 IP addresses in any and all of the files under /var/lib/output/*, ignoring whatever else may be in those files. Perform a reverse lookup on each, and format the output neatly, like "IP=192.168.0.1, ... (0 Replies)
Discussion started by: choco4202002
0 Replies

9. Shell Programming and Scripting

lookup script

hello I am a student taking an intro to UNIX class. I have an assignment I am having trouble completing. The assignment is as follows. i have a file called .addr_book that has various names and phone numbers in it. I need to write a script called lookup that will run like this I... (2 Replies)
Discussion started by: tampaJim
2 Replies
Login or Register to Ask a Question