<?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 script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047934#M303907</link>
    <description>Hunki,&lt;BR /&gt;I will sugest to use the following&lt;BR /&gt;&lt;BR /&gt;cat /etc/hosts | awk '{print $2}' | xargs -t -i ping {} -n 1&lt;BR /&gt;OR&lt;BR /&gt;for server in `cat /etc/hosts | awk '{print $2}'`&lt;BR /&gt;do&lt;BR /&gt;echo "$server : \c"&lt;BR /&gt;ping $server -n1 | awk '/transmitted/ {print $0}'&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope it helps</description>
    <pubDate>Wed, 01 Aug 2007 13:03:01 GMT</pubDate>
    <dc:creator>Juan M Leon</dc:creator>
    <dc:date>2007-08-01T13:03:01Z</dc:date>
    <item>
      <title>ping script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047931#M303904</link>
      <description>&lt;BR /&gt;For - Write a script that will ping a list of hosts and return how many are 'alive'.&lt;BR /&gt;&lt;BR /&gt;I am trying out the following :&lt;BR /&gt;&lt;BR /&gt;cat /etc/hosts|awk '{print $2}'|sort -u|grep -v ^$|xargs ping &lt;BR /&gt;&lt;BR /&gt;it gives me the following error : &lt;BR /&gt;&lt;BR /&gt;ping: bad timeout:hostname&lt;BR /&gt;&lt;BR /&gt;when I pass the above command to a variable I get :&lt;BR /&gt;&lt;BR /&gt;host1 host2 host3 host4&lt;BR /&gt;&lt;BR /&gt;with no carriage returns . How do I overcome this.&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Wed, 01 Aug 2007 12:48:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047931#M303904</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-08-01T12:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: ping script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047932#M303905</link>
      <description>&lt;BR /&gt;the result : &lt;BR /&gt;&lt;BR /&gt;host1 host2 host3 is when I do echo $VAR</description>
      <pubDate>Wed, 01 Aug 2007 12:49:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047932#M303905</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-08-01T12:49:27Z</dc:date>
    </item>
    <item>
      <title>Re: ping script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047933#M303906</link>
      <description>See Clay's answer to a remarkable similar question in this thread:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1149721" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1149721&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 01 Aug 2007 12:52:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047933#M303906</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2007-08-01T12:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: ping script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047934#M303907</link>
      <description>Hunki,&lt;BR /&gt;I will sugest to use the following&lt;BR /&gt;&lt;BR /&gt;cat /etc/hosts | awk '{print $2}' | xargs -t -i ping {} -n 1&lt;BR /&gt;OR&lt;BR /&gt;for server in `cat /etc/hosts | awk '{print $2}'`&lt;BR /&gt;do&lt;BR /&gt;echo "$server : \c"&lt;BR /&gt;ping $server -n1 | awk '/transmitted/ {print $0}'&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope it helps</description>
      <pubDate>Wed, 01 Aug 2007 13:03:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047934#M303907</guid>
      <dc:creator>Juan M Leon</dc:creator>
      <dc:date>2007-08-01T13:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: ping script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047935#M303908</link>
      <description>You need to specify how many packets the ping(1M) program should send out before moving onto the next hostname in the /etc/hosts file or until end of file:&lt;BR /&gt;&lt;BR /&gt;# cat /etc/hosts | egrep -v '^#|^$' | xargs -n1 -i ping {} -n 2</description>
      <pubDate>Wed, 01 Aug 2007 13:22:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047935#M303908</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-08-01T13:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: ping script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047936#M303909</link>
      <description>&lt;!--!*#--&gt;Use the attached Perl script and the rest is easy. You can select ICMP, UDP, or TCP as well as the number of tries and the timeout for each. All you have to do is test the result; 0 --&amp;gt; Good.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;HOSTS="huey louie dewey"&lt;BR /&gt;for HOST in ${HOSTS}&lt;BR /&gt;  do&lt;BR /&gt;    ping.pl -t 5 -n 3 ${HOST}&lt;BR /&gt;    STAT=${?}&lt;BR /&gt;    if [[ ${STAT} -eq 0 ]]&lt;BR /&gt;      then&lt;BR /&gt;        echo "${HOST} is alive."&lt;BR /&gt;      else&lt;BR /&gt;        echo "${HOST} failed; status ${STAT}." &amp;gt;&amp;amp;2&lt;BR /&gt;      fi&lt;BR /&gt;   done&lt;BR /&gt;--------------------------------------&lt;BR /&gt;&lt;BR /&gt;Invoke as ping.pl -u for full usage.&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Aug 2007 13:36:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047936#M303909</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-08-01T13:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: ping script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047937#M303910</link>
      <description>I put that in your other thread:&lt;BR /&gt;&lt;BR /&gt;for i in `cat hosts`&lt;BR /&gt;do&lt;BR /&gt;ping $i -n 1 | grep "0%" &amp;gt;/dev/null&lt;BR /&gt;t=`echo $?`&lt;BR /&gt;ttl=`expr $ttl + $t`&lt;BR /&gt;done&lt;BR /&gt;echo "there are $ttl hosts alive..."&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Wed, 01 Aug 2007 13:45:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047937#M303910</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2007-08-01T13:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: ping script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047938#M303911</link>
      <description>&lt;BR /&gt;Thanks All for replying , I am looking at Sandman's solution , &lt;BR /&gt;&lt;BR /&gt;what does -n1 and -i signify. Please throw some light on this please.&lt;BR /&gt;&lt;BR /&gt;Thanks,</description>
      <pubDate>Wed, 01 Aug 2007 14:26:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047938#M303911</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-08-01T14:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: ping script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047939#M303912</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; what does -n1 and -i signify&lt;BR /&gt;&lt;BR /&gt;I suggest that you consult the manpages.  You will learn more by researching questions like this yourself.&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 01 Aug 2007 14:30:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047939#M303912</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-08-01T14:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: ping script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047940#M303913</link>
      <description>&amp;gt;&amp;gt; what does -n1 and -i signify. Please throw some light on this please.&lt;BR /&gt;&lt;BR /&gt;More than anything, it signifies that you are too lazy/unmotivated/uninformed/... to do a "man xargs". Unless you learn to use the man pages well, you will never have a very successful career in UNIX.</description>
      <pubDate>Wed, 01 Aug 2007 14:33:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047940#M303913</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-08-01T14:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: ping script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047941#M303914</link>
      <description>"-n1" and "-i" are arguments to xargs. This is different from the arguments to ping. The "-n1" argument to xargs means that the hostnames are passed one at a time to the ping command instead of being bundled together. And the "-i" argument [in this case] is a placeholder for the hostname and corresponds to the curly braces. It's a way of specifying where on the command line will the pipelined hostname argument fall. This is so that the arguments to ping(1M) i.e. hostname and "-n 2" [which is the number of packets that should be sent out before moving onto the next host or until the end of /etc/hosts is reached] are placed correctly on the command line.&lt;BR /&gt;&lt;BR /&gt;~hope it helps</description>
      <pubDate>Wed, 01 Aug 2007 14:39:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047941#M303914</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-08-01T14:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: ping script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047942#M303915</link>
      <description>I always check with the man to find answer to command line and arguments.&lt;BR /&gt;&lt;BR /&gt;LOL&lt;BR /&gt;&lt;BR /&gt;-i is insert the previous stdout&lt;BR /&gt;-n uses number of arguments to pass from the previous stdout&lt;BR /&gt;&lt;BR /&gt;good luck</description>
      <pubDate>Wed, 01 Aug 2007 14:55:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047942#M303915</guid>
      <dc:creator>Juan M Leon</dc:creator>
      <dc:date>2007-08-01T14:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: ping script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047943#M303916</link>
      <description>You can of course replace every instance of evil/useless cat in the examples here:&lt;BR /&gt;awk '{print $2}' /etc/hosts |sort -u|grep -v ^$|xargs ping&lt;BR /&gt;grep -v -e '^#' -e '^$' /etc/hosts | xargs -n1 -i ping {} -n 2&lt;BR /&gt;$ for i in $(&amp;lt; /etc/hosts ); do</description>
      <pubDate>Wed, 01 Aug 2007 22:39:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ping-script/m-p/4047943#M303916</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-08-01T22:39:54Z</dc:date>
    </item>
  </channel>
</rss>

