<?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: shell script - ping list of hostname in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462423#M14587</link>
    <description>Hi NIK,&lt;BR /&gt;&lt;BR /&gt;You might want to have a look at the perl script DOWNTIME. Visit &lt;A href="http://WWW.FRESHMEAT.NET" target="_blank"&gt;WWW.FRESHMEAT.NET&lt;/A&gt; for the exact URL. This script does exactly that what you need.&lt;BR /&gt;&lt;BR /&gt;Good luck !&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 08 Nov 2000 10:45:22 GMT</pubDate>
    <dc:creator>RuudPeters</dc:creator>
    <dc:date>2000-11-08T10:45:22Z</dc:date>
    <item>
      <title>shell script - ping list of hostname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462412#M14576</link>
      <description>-- HPUX 10.20 --&lt;BR /&gt;I have a list of hostnames in a text file (1 host to each line) and I would like some help on writing a script that could ping each of these hostnames and report back which hosts did not respond?&lt;BR /&gt;Sorry, but so far I have no idea how to start this... So I thought I'd post this as I browse through Essential SysAdm for any tips...  thanks people!</description>
      <pubDate>Tue, 07 Nov 2000 15:23:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462412#M14576</guid>
      <dc:creator>Nik</dc:creator>
      <dc:date>2000-11-07T15:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: shell script - ping list of hostname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462413#M14577</link>
      <description>could try&lt;BR /&gt;&lt;BR /&gt;for HOSTNAME in hosta hostb hostc hostd&lt;BR /&gt;do&lt;BR /&gt;ping $HOSTNAME -n 1&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Nov 2000 15:30:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462413#M14577</guid>
      <dc:creator>Tony Constantine_1</dc:creator>
      <dc:date>2000-11-07T15:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: shell script - ping list of hostname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462414#M14578</link>
      <description>Here my little script&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;LANG=C&lt;BR /&gt;HOSTNAME_FILE=..... # insert here your file&lt;BR /&gt;for host in $(cat $HOSTNAME_FILE)&lt;BR /&gt;do&lt;BR /&gt;  ping $host -n 1 | grep -q '1 packets received'&lt;BR /&gt;  if [ $? = 0 ]&lt;BR /&gt;  then&lt;BR /&gt;    echo "$host: OK"&lt;BR /&gt;  else&lt;BR /&gt;    echo "$host: FAIL"&lt;BR /&gt;  fi&lt;BR /&gt;done</description>
      <pubDate>Tue, 07 Nov 2000 15:31:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462414#M14578</guid>
      <dc:creator>Rainer_1</dc:creator>
      <dc:date>2000-11-07T15:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: shell script - ping list of hostname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462415#M14579</link>
      <description>Sorry if there in a text file it will be&lt;BR /&gt;&lt;BR /&gt;for HOSTNAME in `more /tmp/hostname.txt`&lt;BR /&gt;do&lt;BR /&gt;ping $HOSTNAME -n 1&lt;BR /&gt;done</description>
      <pubDate>Tue, 07 Nov 2000 15:32:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462415#M14579</guid>
      <dc:creator>Tony Constantine_1</dc:creator>
      <dc:date>2000-11-07T15:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: shell script - ping list of hostname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462416#M14580</link>
      <description>you can do something like this :-&lt;BR /&gt;&lt;BR /&gt;for i in ` cat (your file with hosts) `&lt;BR /&gt;do&lt;BR /&gt;  ping $i -n 1 | grep -q "100%"&lt;BR /&gt;  if [[ $? = 0 ]]&lt;BR /&gt;   then&lt;BR /&gt;      print " network $i not reachable"&lt;BR /&gt; fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;HTH</description>
      <pubDate>Tue, 07 Nov 2000 15:35:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462416#M14580</guid>
      <dc:creator>Devbinder Singh Marway</dc:creator>
      <dc:date>2000-11-07T15:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: shell script - ping list of hostname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462417#M14581</link>
      <description>What I have done in the past is this:&lt;BR /&gt;&lt;BR /&gt;script&lt;BR /&gt;&lt;BR /&gt;ping host1 64 5&lt;BR /&gt;ping host2 64 5&lt;BR /&gt;ping host3 64 5&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I then run the script and redirect stderr and stdout to a file and then go look at the file to determine what responded and what didn't.&lt;BR /&gt;&lt;BR /&gt;to run the script:&lt;BR /&gt;&lt;BR /&gt;./script &amp;gt; script.out 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Nov 2000 15:35:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462417#M14581</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2000-11-07T15:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: shell script - ping list of hostname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462418#M14582</link>
      <description>wow! that's fantastic!&lt;BR /&gt;thanks to everyone...</description>
      <pubDate>Tue, 07 Nov 2000 15:39:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462418#M14582</guid>
      <dc:creator>Nik</dc:creator>
      <dc:date>2000-11-07T15:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: shell script - ping list of hostname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462419#M14583</link>
      <description>Points are much appreciated as well.</description>
      <pubDate>Tue, 07 Nov 2000 15:42:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462419#M14583</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2000-11-07T15:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: shell script - ping list of hostname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462420#M14584</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while read HOST&lt;BR /&gt;do&lt;BR /&gt;  ping $HOST -n 3&lt;BR /&gt;done &amp;lt; /tmp/ping.lst&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 07 Nov 2000 15:44:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462420#M14584</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2000-11-07T15:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: shell script - ping list of hostname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462421#M14585</link>
      <description>Try this:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;##&lt;BR /&gt;###&lt;BR /&gt;####&lt;BR /&gt;#####&lt;BR /&gt;for x in `cat /etc/hosts | awk ' $1 !~ /^#/ { print $1 } '`&lt;BR /&gt;do&lt;BR /&gt;        ping $x -n 5&lt;BR /&gt;&lt;BR /&gt;        if [ $? -ne 0 ]&lt;BR /&gt;        then&lt;BR /&gt;                grep $x /etc/hosts&lt;BR /&gt;        fi&lt;BR /&gt;done</description>
      <pubDate>Tue, 07 Nov 2000 21:21:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462421#M14585</guid>
      <dc:creator>Rob Smith</dc:creator>
      <dc:date>2000-11-07T21:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: shell script - ping list of hostname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462422#M14586</link>
      <description>One note of caution: at 10.20, at least, ping returns 0 whether the packet has been lost or not.  Testing for $? is not a valid way to determine whether connectivity exists.  Here is a solution I have used in the past:&lt;BR /&gt;&lt;BR /&gt;PING=`ping $SERVER -n 1|grep %| awk '{print $7}'`&lt;BR /&gt;if [ ${PING%%} = 0 ]&lt;BR /&gt;then&lt;BR /&gt;    echo ping test succeeded&lt;BR /&gt;else&lt;BR /&gt;    echo ping test failed&lt;BR /&gt;fi</description>
      <pubDate>Tue, 07 Nov 2000 22:46:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462422#M14586</guid>
      <dc:creator>Alan Riggs</dc:creator>
      <dc:date>2000-11-07T22:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: shell script - ping list of hostname</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462423#M14587</link>
      <description>Hi NIK,&lt;BR /&gt;&lt;BR /&gt;You might want to have a look at the perl script DOWNTIME. Visit &lt;A href="http://WWW.FRESHMEAT.NET" target="_blank"&gt;WWW.FRESHMEAT.NET&lt;/A&gt; for the exact URL. This script does exactly that what you need.&lt;BR /&gt;&lt;BR /&gt;Good luck !&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Nov 2000 10:45:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-ping-list-of-hostname/m-p/2462423#M14587</guid>
      <dc:creator>RuudPeters</dc:creator>
      <dc:date>2000-11-08T10:45:22Z</dc:date>
    </item>
  </channel>
</rss>

