<?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 HP-UX Script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-script/m-p/2852029#M93853</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I just wrote some script in HP-UX regarding the ECHO ping.&lt;BR /&gt;&lt;BR /&gt;when I execute a command &lt;BR /&gt;IP="202.202.202.202 (example)&lt;BR /&gt;and then &lt;BR /&gt;/usr/sbin/ping $IP -n 1 |wc -c&lt;BR /&gt;&lt;BR /&gt;a return value is 226.&lt;BR /&gt;&lt;BR /&gt;so when I change the IP to a fake IP let say IP=202.202.202.203 and I execute a command&lt;BR /&gt;/usr/sbin/ping $IP -n 1 |wc -c&lt;BR /&gt;&lt;BR /&gt;a return value is 135.&lt;BR /&gt;&lt;BR /&gt;After tht I execute a same command with real IP so I get return value is 230.&lt;BR /&gt;&lt;BR /&gt;So my question i how can I put a two condition where are if return values is 226 OR 230 so a retval=1. My example script &lt;BR /&gt;&lt;BR /&gt;IP="202.202.202.202"&lt;BR /&gt;&lt;BR /&gt;    CONTACT=$(/usr/sbin/ping $IP -n 1 | wc -c)&lt;BR /&gt;    if [ "$CONTACT" -eq 226 ] &lt;BR /&gt;      then&lt;BR /&gt;        retval=0&lt;BR /&gt;    else&lt;BR /&gt;        retval=1&lt;BR /&gt;    fi&lt;BR /&gt;    echo "Destination Status"  $retval&lt;BR /&gt;    return retval&lt;BR /&gt;</description>
    <pubDate>Tue, 26 Nov 2002 08:15:42 GMT</pubDate>
    <dc:creator>NOR AZLY MOHD NOR</dc:creator>
    <dc:date>2002-11-26T08:15:42Z</dc:date>
    <item>
      <title>HP-UX Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-script/m-p/2852029#M93853</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I just wrote some script in HP-UX regarding the ECHO ping.&lt;BR /&gt;&lt;BR /&gt;when I execute a command &lt;BR /&gt;IP="202.202.202.202 (example)&lt;BR /&gt;and then &lt;BR /&gt;/usr/sbin/ping $IP -n 1 |wc -c&lt;BR /&gt;&lt;BR /&gt;a return value is 226.&lt;BR /&gt;&lt;BR /&gt;so when I change the IP to a fake IP let say IP=202.202.202.203 and I execute a command&lt;BR /&gt;/usr/sbin/ping $IP -n 1 |wc -c&lt;BR /&gt;&lt;BR /&gt;a return value is 135.&lt;BR /&gt;&lt;BR /&gt;After tht I execute a same command with real IP so I get return value is 230.&lt;BR /&gt;&lt;BR /&gt;So my question i how can I put a two condition where are if return values is 226 OR 230 so a retval=1. My example script &lt;BR /&gt;&lt;BR /&gt;IP="202.202.202.202"&lt;BR /&gt;&lt;BR /&gt;    CONTACT=$(/usr/sbin/ping $IP -n 1 | wc -c)&lt;BR /&gt;    if [ "$CONTACT" -eq 226 ] &lt;BR /&gt;      then&lt;BR /&gt;        retval=0&lt;BR /&gt;    else&lt;BR /&gt;        retval=1&lt;BR /&gt;    fi&lt;BR /&gt;    echo "Destination Status"  $retval&lt;BR /&gt;    return retval&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Nov 2002 08:15:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-script/m-p/2852029#M93853</guid>
      <dc:creator>NOR AZLY MOHD NOR</dc:creator>
      <dc:date>2002-11-26T08:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: HP-UX Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-script/m-p/2852030#M93854</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;Try :&lt;BR /&gt;&lt;BR /&gt;CONTACT=$(/usr/sbin/ping $IP -n 1 | wc -c) &lt;BR /&gt;if [ "$CONTACT" -eq 226 -o "$CONTACT" -eq 230 ] &lt;BR /&gt;then &lt;BR /&gt;retval=0 &lt;BR /&gt;else &lt;BR /&gt;retval=1 &lt;BR /&gt;fi &lt;BR /&gt;echo "Destination Status" $retval &lt;BR /&gt;return retval &lt;BR /&gt;&lt;BR /&gt;Then you will have retval = 0 for CONTACT = 226 OR 230.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Fr??d??ric&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Nov 2002 08:23:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-script/m-p/2852030#M93854</guid>
      <dc:creator>Frederic Sevestre</dc:creator>
      <dc:date>2002-11-26T08:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: HP-UX Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-script/m-p/2852031#M93855</link>
      <description>IP="202.202.202.202" &lt;BR /&gt;&lt;BR /&gt;CONTACT=$(/usr/sbin/ping $IP -n 1 | wc -c) &lt;BR /&gt;if [ "$CONTACT" -eq 226 -o "$CONTACT" -eq 230 ] &lt;BR /&gt;then &lt;BR /&gt;retval=0 &lt;BR /&gt;else &lt;BR /&gt;retval=1 &lt;BR /&gt;fi &lt;BR /&gt;echo "Destination Status" $retval &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Nov 2002 08:28:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-script/m-p/2852031#M93855</guid>
      <dc:creator>Niraj Kumar Verma</dc:creator>
      <dc:date>2002-11-26T08:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: HP-UX Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-script/m-p/2852032#M93856</link>
      <description>Hi,&lt;BR /&gt;for a limited number of return values, you could make use of a case-structure, e.g.:&lt;BR /&gt;&lt;BR /&gt;case $CONTACT in&lt;BR /&gt;226) retval=0;;&lt;BR /&gt;230) retval=0;;&lt;BR /&gt;*) retval=1;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Tue, 26 Nov 2002 08:42:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-script/m-p/2852032#M93856</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2002-11-26T08:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: HP-UX Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-script/m-p/2852033#M93857</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;If you are looking for a script to monitor the network&lt;BR /&gt;check this&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;IP="202.202.202.202"&lt;BR /&gt;CONTACT=$(/usr/sbin/ping $IP -n 1 |tail -2 |grep "%" |tail -1 |awk -F"," '{print $3}'|awk -F"%" '{print $1}')&lt;BR /&gt;&lt;BR /&gt;if [ "$CONTACT" -lt 100 ]&lt;BR /&gt;then&lt;BR /&gt;echo "LINK UP"&lt;BR /&gt;else&lt;BR /&gt;echo "LINK Down"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;-Niraj</description>
      <pubDate>Tue, 26 Nov 2002 08:48:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-script/m-p/2852033#M93857</guid>
      <dc:creator>Niraj Kumar Verma</dc:creator>
      <dc:date>2002-11-26T08:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: HP-UX Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-script/m-p/2852034#M93858</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks everyone.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;My problem resolves.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;AZLY</description>
      <pubDate>Tue, 26 Nov 2002 08:52:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-script/m-p/2852034#M93858</guid>
      <dc:creator>NOR AZLY MOHD NOR</dc:creator>
      <dc:date>2002-11-26T08:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: HP-UX Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-script/m-p/2852035#M93859</link>
      <description>Hmm, besides this discussion about checking for multiple cases... looks like you are checking for the byte count of the messages returned by ping? Seems to be a liitle bit risky INHO...&lt;BR /&gt;&lt;BR /&gt;What about...&lt;BR /&gt;&lt;BR /&gt;ping $IP  -n 1 | grep -q "bytes from"&lt;BR /&gt;retval=$?&lt;BR /&gt;echo "Destination Status" $retval &lt;BR /&gt;return retval &lt;BR /&gt;&lt;BR /&gt;Best regards...&lt;BR /&gt; Dietmar.</description>
      <pubDate>Tue, 26 Nov 2002 08:53:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hp-ux-script/m-p/2852035#M93859</guid>
      <dc:creator>Dietmar Konermann</dc:creator>
      <dc:date>2002-11-26T08:53:15Z</dc:date>
    </item>
  </channel>
</rss>

