Sponsored Content
Top Forums Shell Programming and Scripting Perl : code on ping showing difference result Post 302766693 by scriptscript on Tuesday 5th of February 2013 06:57:28 AM
Old 02-05-2013
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.
Code:
    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 "success";
    }
    else
    {
         print "Fail";
    }     
    $p->close();

For one IP address.. I received the status as "Fail" . But when tried using start->run-> cmd ->ping ipaddress .. the ping is successful.

COuld you let me know any other alternative code to ping the device.

---------- Post updated at 06:57 AM ---------- Previous update was at 06:50 AM ----------

Hi all,

I am using the below code to ping a code and print whehter the connection is successful or not.
Code:
    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 "success";
    }
    else
    {
         print "Fail";
    }     
    $p->close();

For one IP address.. I received the status as "Fail" . But when tried using start->run-> cmd ->ping ipaddress .. the ping is successful.

COuld you let me know any other alternative code to ping the device.
 

9 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

defined value not showing....in the result

Hi, PLMN=APPLE awk ' /is missing/ { flag=1;print > "fruit_output_m1.txt" } END { if( flag != 1 ) print "No $PLMN in the store." > "fruit_output_n1.txt" } ' fruit_result.txt The output is: No $PLMN in the store. Should be: No APPLE in the store. Please help!! (1 Reply)
Discussion started by: happyv
1 Replies

3. Shell Programming and Scripting

Help with showing the difference in two lines of input

I would like my script to be able to tell the difference between to lines of input, like: Input 1: 1 2 3 4 5 Input 2: 1 2 3 4 5 6 I want the script to tell me that the difference between the two lines is the 6. Is there anyway I can have it do this? Here's an example of what my script... (12 Replies)
Discussion started by: Kweekwom
12 Replies

4. Shell Programming and Scripting

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 ----------... (2 Replies)
Discussion started by: netxus
2 Replies

5. 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

6. 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

7. Solaris

solaris link aggregation problem , once i reboot it is not showing, not able to ping the default gat

Hi All, I am trying to aggregate the NIC's,(igb2 and igb3) (igb0 is used by the physical system and igb1 is used by primary-vsw0) to create the domains on that for faster data transfer, I followed the process for creating the aggregation, dladm create-aggr -d igb2 -d igb3 1 after creating the... (2 Replies)
Discussion started by: buildscm
2 Replies

8. Shell Programming and Scripting

Ping result talking too long

Hello all, I am writing a script that pings various machines to check connectivity. If a machine is available, the prompt returns a result immediately: root@ops # ping 172.21.5.5 172.21.5.5 is alive BUT if a machine is Down , the reply takes a long time to come. The issue is I want to... (1 Reply)
Discussion started by: Junaid Subhani
1 Replies

9. Shell Programming and Scripting

Ssh on ping result?

I still haven't had chance to read the entire Debian manual, which I promise I will do as soon as I can, and I will start putting info back into this forum. However, for the mean time, could someone please help with a small script? I understand what I've got to do and how to do it, but I'm... (13 Replies)
Discussion started by: MuntyScrunt
13 Replies
asadmin-ping-connection-pool(1AS)				   User Commands				 asadmin-ping-connection-pool(1AS)

NAME
asadmin-ping-connection-pool, ping-connection-pool - tests that a connection pool is usable SYNOPSIS
ping-connection-pool --user admin_user [--password admin_password] [--host localhost] [--port 4848] [--secure|-s] [--passwordfile filename] [--terse=false] [--echo=false] [--interactive=true] pool_name Tests that a connection pool is usable for both JDBC connection pools and connector connection pools. For example, if you create a new JDBC connection pool for use with an application that is expected to be deployed, before deploying the application, the previously created pool is tested with this command. This command is supported in remote mode only. OPTIONS
--user authorized domain application server administrative username. --password password to administer the domain application server. --host machine name where the domain application server is running. --port port number of the domain application server listening for administration requests. --secure if true, uses SSL/TLS to communicate with the domain application server. --passwordfile file containing the domain application server password. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. Default is false. --echo setting to true will echo the command line statement on the standard output. Default is false. --interactive if set to true (default), only the required password options are prompted. OPERANDS
poolname name of the connection pool to be tested. Example 1: Using ping-connection-pool Before you can ping a connection pool, you must: o Create a connection pool with authentication. o Make sure the Enterprise Information Server (can be the database) is started. asadmin> ping-connection-pool --user admin1 --password adminadmin1 --host pigeon --port 5001 sampleConnectionPool Command ping-connection-pool executed successfully EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-create-connector-connection-pool(1AS), asadmin-delete-connector-connection-pool(1AS), asadmin-list-connector-connection-pool(1AS), asadmin-create-jdbc-connection-pool(1AS), asadmin-delete--jdbc-connection-pool(1AS)asadmin- list--jdbc-connection-pools(1AS) J2EE 1.4 SDK March 2004 asadmin-ping-connection-pool(1AS)
All times are GMT -4. The time now is 12:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy