Script Required to Check a range of IP's

2006-06-29 Thread Mazhar
Hi Folks, I have a requirement of writing down a script to check the range of IP's in a text file and display them which all are active and not active. I have written down the below and needs your help because it is not giving me the correct ouptut.

Re: Script Required to Check a range of IP's

2006-06-29 Thread Joshua Colson
On Thu, 2006-06-29 at 19:44 +0400, Mazhar wrote: Hi Folks, I have a requirement of writing down a script to check the range of IP's in a text file and display them which all are active and not active. I have written down the below and needs your help because it is not giving me the

Re: Script Required to Check a range of IP's

2006-06-29 Thread Mazhar
thanks Joshua for the help but the server is very critical and they will not install any external softwares. This is the policy and i have to adhere to the policy... i need a perl script to do so.. Regards Mazhar On 6/29/06, Joshua Colson [EMAIL PROTECTED] wrote: On Thu, 2006-06-29 at 19:44

RE: Script Required to Check a range of IP's

2006-06-29 Thread Ryan Frantz
-Original Message- From: Mazhar [mailto:[EMAIL PROTECTED] Sent: Thursday, June 29, 2006 11:44 AM To: Perl Beginners Subject: Script Required to Check a range of IP's Hi Folks, Howdy, I have a requirement of writing down a script to check the range of IP's in a text file

Re: Script Required to Check a range of IP's

2006-06-29 Thread Mazhar
On 6/29/06, Ryan Frantz [EMAIL PROTECTED] wrote: -Original Message- From: Mazhar [mailto:[EMAIL PROTECTED] Sent: Thursday, June 29, 2006 11:44 AM To: Perl Beginners Subject: Script Required to Check a range of IP's Hi Folks, Howdy, I have a requirement of writing down a

RE: Script Required to Check a range of IP's

2006-06-29 Thread Ryan Frantz
-Original Message- From: Mazhar [mailto:[EMAIL PROTECTED] Sent: Thursday, June 29, 2006 12:51 PM To: Ryan Frantz Cc: Perl Beginners Subject: Re: Script Required to Check a range of IP's On 6/29/06, Ryan Frantz [EMAIL PROTECTED] wrote: -Original Message- From: Mazhar

Re: Script Required to Check a range of IP's

2006-06-29 Thread Prabu
Hello, Hope this is what you need Input File --- test.txt 172.16.1.194 172.16.1.20 172.16.1.200 172.16.1.34 Program to check active or not -- pingpro.pl #!/usr/bin/perl use strict; use warnings; use Net::Ping; my $file_name=$ARGV[0]; my $line; my @host_array; open(FILE,$file_name) || die

Re: Script Required to Check a range of IP's

2006-06-29 Thread Anthony Ettinger
On 6/29/06, Mazhar [EMAIL PROTECTED] wrote: Hi Folks, I have a requirement of writing down a script to check the range of IP's in a text file and display them which all are active and not active. I have written down the below and needs your help because it is not giving me the correct ouptut.

Re: Script Required to Check a range of IP's

2006-06-29 Thread Mr. Shawn H. Corey
On Thu, 2006-29-06 at 19:44 +0400, Mazhar wrote: Hi Folks, I have a requirement of writing down a script to check the range of IP's in a text file and display them which all are active and not active. I have written down the below and needs your help because it is not giving me the

Re: Script Required to Check a range of IP's

2006-06-29 Thread Mazhar
Thanks Prabhu, Your script works Regards Mazhar On 6/29/06, Prabu [EMAIL PROTECTED] wrote: Hello, Hope this is what you need Input File --- test.txt 172.16.1.194 172.16.1.20 172.16.1.200 172.16.1.34 Program to check active or not -- pingpro.pl #!/usr/bin/perl use strict; use

Re: Script Required to Check a range of IP's

2006-06-29 Thread JupiterHost.Net
#!/usr/bin/perl use strict; use warnings; Excellent! use Net::Ping; my $file_name=$ARGV[0]; What if its not given anything? my $line; You don't use this? my @host_array; open(FILE,$file_name) || die Not been Accessed ; Why is $file_name in quotes? Why is the die string in double

Re: Script Required to Check a range of IP's

2006-06-29 Thread Dr.Ruud
Prabu schreef: open(FILE,$file_name) || die Not been Accessed ; open my $fh, '', $file_name or die open $file_name: $! ; if($p-ping($host, 2)) { chomp($host); print $host is alive.\n; } else { chomp($host); print

RE: Script Required to Check a range of IP's

2006-06-29 Thread Ryan Frantz
Here's the same thing but Perl Best Practice ified a bit: #!/usr/bin/perl use strict; use wanrings; use Net::Ping; die 'Please give me a filename as my argument!' if !defined $ARGV[0]; open(my $ipfile_fh, '', $ARGV[0]) || die Could not open $ARGV[0]: $!; my $icmp =

Re: Script Required to Check a range of IP's

2006-06-29 Thread Dr.Ruud
Dr.Ruud schreef: You are calling ping() with an un-comp-ed $host. s/comp/chomp/ -- Affijn, Ruud Gewoon is een tijger. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

RE: Script Required to Check a range of IP's

2006-06-29 Thread Timothy Johnson
You've gotten many good suggestions, but the main problem is that you are doing a TCP ping, and I'm pretty sure you are expecting the results to match your ICMP ping. From the Perldoc: You may choose one of six different protocols to use for the ping. The tcp protocol is the default. Note that a