<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ping RETURN codes in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761759#M892848</link>
    <description>ping is like many network commands such as ftp. The return code will be 0 if there is something valid to perform. The fact that one (or more) ping attempts failed is very different than a failure to get an IP address. In other words, ping will return a failure if the hostname is non-existant because ping can't even get started. And in that case, the error is not ping but DNS or /etc/hosts, or it may be an unreachable network address, none of which are ping's responsibility. But once there is a valid IP address, ping considers itself successful. &lt;BR /&gt;&lt;BR /&gt;The fact that the remote end failed to respond correctly is problematic in terms of a single return code. The IP address may truly be unresponsive (the main reason we use ping) but it might work a few times and fail a few times, or (due to a duplicate IP) get a multiple returns for the same ping attempt, or there might be an excessive delay in getting the ping back.&lt;BR /&gt;&lt;BR /&gt;So as mentioned, ping must be parsed in order to determine exactly what is happening.</description>
    <pubDate>Thu, 11 Jul 2002 11:39:54 GMT</pubDate>
    <dc:creator>Bill Hassell</dc:creator>
    <dc:date>2002-07-11T11:39:54Z</dc:date>
    <item>
      <title>ping RETURN codes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761754#M892843</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;a return code from ping is annoying one of my scripts..&lt;BR /&gt;&lt;BR /&gt;Have a look:&lt;BR /&gt;&lt;BR /&gt;pereal - /home/trsh # ping 1.2.3.4 -n 3&lt;BR /&gt;PING 1.2.3.4: 64 byte packets&lt;BR /&gt;&lt;BR /&gt;----1.2.3.4 PING Statistics----&lt;BR /&gt;3 packets transmitted, 0 packets received, 100% packet loss&lt;BR /&gt;pereal - /home/trsh # echo $?&lt;BR /&gt;0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;pereal - /home/trsh # what /etc/ping&lt;BR /&gt;/etc/ping:&lt;BR /&gt;         PHNE_16158 ping.c $Revision: 1.8.119.5 $ $Date: 98/07/23 14:27:01 $&lt;BR /&gt;        NET:    Version: B.11.00  $Date: 97/10/15 10:44:23 $&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Jul 2002 08:55:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761754#M892843</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2002-07-11T08:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: ping RETURN codes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761755#M892844</link>
      <description>&lt;BR /&gt;ping has always been non-existant in returing any error codes apart from 0. Instead scripts I use to see if something is pingable all grep for "100% packet loss" to see if it worked or not.&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Jul 2002 09:01:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761755#M892844</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2002-07-11T09:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: ping RETURN codes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761756#M892845</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I agree with Stefan. Have a conditional statement to set the return code, like this:&lt;BR /&gt;&lt;BR /&gt;# if ping 1.2.3.4 -n 3 | grep '100%' &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 ; then exit 1; else exit 0 ; fi&lt;BR /&gt;# echo $?&lt;BR /&gt;1&lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong</description>
      <pubDate>Thu, 11 Jul 2002 09:18:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761756#M892845</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2002-07-11T09:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: ping RETURN codes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761757#M892846</link>
      <description>ping returns 1 though if I do it this way:&lt;BR /&gt;&lt;BR /&gt;pereal - /home/trsh # /etc/ping bobby -n 1&lt;BR /&gt;/etc/ping: unknown host bobby&lt;BR /&gt;pereal - /home/trsh # echo $?&lt;BR /&gt;1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Anyway, thanks for the info!&lt;BR /&gt;I'll incorporate that!&lt;BR /&gt;&lt;BR /&gt;Later,&lt;BR /&gt;Bill&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Jul 2002 09:31:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761757#M892846</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2002-07-11T09:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: ping RETURN codes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761758#M892847</link>
      <description>Moral:&lt;BR /&gt;&lt;BR /&gt;If for a particular command, i.e. ping(1M) in this case, "RETURN VALUE" is not *documented*, then don't assume it is set (to some meaningful, reliable, etc. value). I.e. the right approach is somthingike Steven has suggested.&lt;BR /&gt;&lt;BR /&gt;If you want to blame someone, then blame the AUTHOR! :-)</description>
      <pubDate>Thu, 11 Jul 2002 10:42:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761758#M892847</guid>
      <dc:creator>Frank Slootweg</dc:creator>
      <dc:date>2002-07-11T10:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: ping RETURN codes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761759#M892848</link>
      <description>ping is like many network commands such as ftp. The return code will be 0 if there is something valid to perform. The fact that one (or more) ping attempts failed is very different than a failure to get an IP address. In other words, ping will return a failure if the hostname is non-existant because ping can't even get started. And in that case, the error is not ping but DNS or /etc/hosts, or it may be an unreachable network address, none of which are ping's responsibility. But once there is a valid IP address, ping considers itself successful. &lt;BR /&gt;&lt;BR /&gt;The fact that the remote end failed to respond correctly is problematic in terms of a single return code. The IP address may truly be unresponsive (the main reason we use ping) but it might work a few times and fail a few times, or (due to a duplicate IP) get a multiple returns for the same ping attempt, or there might be an excessive delay in getting the ping back.&lt;BR /&gt;&lt;BR /&gt;So as mentioned, ping must be parsed in order to determine exactly what is happening.</description>
      <pubDate>Thu, 11 Jul 2002 11:39:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761759#M892848</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2002-07-11T11:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: ping RETURN codes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761760#M892849</link>
      <description>Hi Bill:&lt;BR /&gt;&lt;BR /&gt;Here's one method that will give you a reliable&lt;BR /&gt;exit status (0 = good; non-zero bad like a good little program): This one pings and time outs in 5 seconds if no response.&lt;BR /&gt;&lt;BR /&gt;ping.pl -t 5 remote_host&lt;BR /&gt;STAT=$?&lt;BR /&gt;if [ ${STAT} -eq 0 ]&lt;BR /&gt;  then&lt;BR /&gt;    echo "Good"&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;Invoke it as ping.pl -u for full usage. Note, if you are using this script on a Windows box, you should comment out the alarm() function. It's not supported on Windows.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Jul 2002 12:56:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761760#M892849</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-07-11T12:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: ping RETURN codes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761761#M892850</link>
      <description>Hello Bill,&lt;BR /&gt;&lt;BR /&gt;How about this way?&lt;BR /&gt;&lt;BR /&gt;  for system in `cat $WORK_DIR/criping.source`&lt;BR /&gt;  do&lt;BR /&gt;    if /etc/ping $system 64 1 &amp;gt; /dev/null&lt;BR /&gt;      then&lt;BR /&gt;                RET2="`echo $system` `/etc/ping $system 64 1 | grep bytes | awk {'print $6'}`"&lt;BR /&gt;      echo $RET2 | grep -v time &amp;gt;&amp;gt; $WORK_DIR/criping.result&lt;BR /&gt;    fi&lt;BR /&gt;  done&lt;BR /&gt;&lt;BR /&gt;Then proceed by [ -s $WORK_DIR/criping.result ]. &lt;BR /&gt;&lt;BR /&gt;You may want to run a loop for two runs, as ping may not sometimes succeed the first time. &lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Anu Mathew</description>
      <pubDate>Thu, 11 Jul 2002 15:23:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761761#M892850</guid>
      <dc:creator>Anu Mathew</dc:creator>
      <dc:date>2002-07-11T15:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: ping RETURN codes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761762#M892851</link>
      <description>We have a open bug report to HP for that.&lt;BR /&gt;Use ping from 10.20 - that works fine (we got this info from HP)&lt;BR /&gt;We got the binary from them because we only have 11.0&lt;BR /&gt;&lt;BR /&gt;We wait since 1 year for the patch for 11.0&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Jul 2002 09:13:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-return-codes/m-p/2761762#M892851</guid>
      <dc:creator>Stefan Marquardt_1</dc:creator>
      <dc:date>2002-07-12T09:13:31Z</dc:date>
    </item>
  </channel>
</rss>

