perl ping script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting perl ping script
# 1  
Old 09-26-2009
perl ping script

Dear All
Any one able been writing any command ping in perl??basically i want to wring ping script to send 1000 packet ping then initiate "Ctrl C' terminal to ping example below:-]
#!/usr/local/bin/perl
$r=`/bin/ping 172.23.11.254`;

Thank You

---------- Post updated at 10:27 PM ---------- Previous update was at 08:14 PM ----------

basically the script i want to get the ping statistics. normally i have to run ping command then "Ctrl C" to get the ping statistics

--- 172.23.11.254 ping statistics ---
1000 packets transmitted, 1000 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.267/0.267/0.267/0.000 ms
# 2  
Old 09-26-2009
you can all 'ping -c <number>' e.g. 'ping -c 100' to specify when ping should exit. You can also specify '-t' with a number of seconds for timeouts. you don't have to exit with ctrl-c.
# 3  
Old 09-28-2009
in solaris seem not workingSmilie

---------- Post updated at 03:33 AM ---------- Previous update was at 01:51 AM ----------

Hi varontron thank your help..i can ping statistics in solaris i just use
'ping -s 172.23.11.254 64 100' then can already

/usr/sbin/ping -s [-l | -U] [-adlLnrRv] [-A addr_family]
[-c traffic_class] [-g gateway [ -g gateway...]] [-
F flow_label] [-I interval] [-i interface] [-P tos] [-
p port] [-t ttl] host [data_size] [npackets]

---------- Post updated at 03:33 AM ---------- Previous update was at 03:33 AM ----------

Hi varontron thank your help..i can ping statistics in solaris i just use
'ping -s 172.23.11.254 64 100' then can already

/usr/sbin/ping -s [-l | -U] [-adlLnrRv] [-A addr_family]
[-c traffic_class] [-g gateway [ -g gateway...]] [-
F flow_label] [-I interval] [-i interface] [-P tos] [-
p port] [-t ttl] host [data_size] [npackets]
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Ping test sends mail when ping fails

help with bash script! im am working on this script to make sure my server will stay online, so i made this script.. HOSTS="192.168.138.155" COUNT=4 pingtest(){ for myhost in "$@" do ping -c "$COUNT" "$myhost" &&return 1 done return 0 } if pingtest $HOSTS #100% failed... (4 Replies)
Discussion started by: mort3924
4 Replies

2. Shell Programming and Scripting

Perl : code on ping showing difference result

Hi all, I am using the below code to ping a code and print whehter the connection is successful or not. use Net::Ping; $p = Net::Ping->new(); my $host = "x.x.x.x"; # print "$host is alive.\n" if $p->ping($host); if ($p->ping($host,3)) { print... (0 Replies)
Discussion started by: scriptscript
0 Replies

3. Shell Programming and Scripting

Perl : ping for multiple IPs not working

I have written perl ping program to ping list of IPs one by one and print the status.But each and every time it is showing the status as Pass for all IPs even though the IP is wrong. multipleip.pl use Net::Ping; $p = Net::Ping->new(); $ifile="inventory.txt"; ... (2 Replies)
Discussion started by: scriptscript
2 Replies

4. Shell Programming and Scripting

Need bash script to ping the servers and rename the output file each time the script is ran

HI, I have a file serverlist in that all host names are placed. i have written a small script #./testping #! /bin/bash for i in `cat serverlist` do ping $i >> output.txt done so now it creates a file output.txt till here fine.. now each time i run this script the output file... (4 Replies)
Discussion started by: madhudeva
4 Replies

5. Shell Programming and Scripting

Ping and Perl

Hi There i have little situation that i could us some help with. We have a dhcp server, but the problem is if that a machine has been offline for a while it loose it's lease and so if you ping it you get unknown host if there a way using perl that it will continue to try and ping it, even tho... (1 Reply)
Discussion started by: ab52
1 Replies

6. Programming

Perl Ping Loop

Hi All i have an issue with ping, we are using dhcp and so if the machine has been offline and i ping it, i get " ping: unknown host <hostname> is there a way i can stick a loop somewhere so it would keep trying when it got the unknown host error and then when the machine came back online... (2 Replies)
Discussion started by: ab52
2 Replies

7. Shell Programming and Scripting

perl return ips after successful ping

Hi, I have this script in ksh, what it does is loop every ip in the nodes_nso and produced another variable up_nodes_nso of only ip's that are up. nodes_nso=$(cat /var/tmp/nodes.txt) echo "ICMP Tests:" up_nodes_nso="" for ip in ${nodes_nso} ; do ping ${ip} 3 > /dev/null if ; then ... (1 Reply)
Discussion started by: borderblaster
1 Replies

8. Shell Programming and Scripting

Perl telnet to cisco router and compare the ping ms

All Please help, i will telnet to router to obain the ping status and compare, if higher than normal latency, i will have further action.. if i do the telent and in perl script then .... e.g the result i obtain from the router will be =' Success rate is 100 percent (5/5), round-trip... (4 Replies)
Discussion started by: optimus
4 Replies

9. Shell Programming and Scripting

Perl Ping Determine Success or Fail

I know how to ping in Perl. That is easy. What I am wondering is if there is a way for Perl to determine whether the ping was successful or not. Or do I need to save the results out and parse the results seperately looking for the #of tries and successful revieves. Thanks. (1 Reply)
Discussion started by: gdboling
1 Replies

10. Shell Programming and Scripting

PERL: ping and e-mail

I need a script to open a text file with ip's in it, ping them, split the results into the ip and time from the results and e-mail them ? here what i've done. its porbly wrong and not workin.its for win nt4 use Net::SMTP; # get list of ip's to ping open (PINGFILE, "< c:\\Documents and... (20 Replies)
Discussion started by: perleo
20 Replies
Login or Register to Ask a Question