<?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 Convert Perl Screpit into Shell in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/convert-perl-screpit-into-shell/m-p/5177083#M459262</link>
    <description>I tried allot to transfer the follwoing code to shell but i couldnt .&lt;BR /&gt;Array is My problem i couldnt code it in shell &lt;BR /&gt;&lt;BR /&gt;#!/opt/OV/bin/Perl/bin/perl&lt;BR /&gt;@nodes = `/opt/OV/bin/OpC/utils/opcnode -list_nodes | grep Name | cut -f 11 -d " " | grep -v MGTSV`;&lt;BR /&gt;chomp(@nodes);&lt;BR /&gt;&lt;BR /&gt;# ping nodes to check theis status &lt;BR /&gt;use Net::Ping ;&lt;BR /&gt;&lt;BR /&gt;$p = Net::Ping-&amp;gt;new("icmp");&lt;BR /&gt;&lt;BR /&gt;        foreach $host (@nodes)&lt;BR /&gt;                {&lt;BR /&gt;                $mon = 1 ;&lt;BR /&gt;                $mon = 0 unless $p-&amp;gt;ping($host, 5);&lt;BR /&gt;                if ( $mon == 0 )&lt;BR /&gt;                        {&lt;BR /&gt;                        $mon = 1;&lt;BR /&gt;                        $mon = 0 unless $p-&amp;gt;ping($host, 15);&lt;BR /&gt;                        }&lt;BR /&gt;                system `/opt/OV/bin/OpC/opcmon check_node_status=$mon -object $host`;&lt;BR /&gt;                }&lt;BR /&gt;$p-&amp;gt;close();&lt;BR /&gt;&lt;BR /&gt;Can anyone help me please</description>
    <pubDate>Sun, 24 May 2009 07:48:17 GMT</pubDate>
    <dc:creator>Salman AlBedaiwi</dc:creator>
    <dc:date>2009-05-24T07:48:17Z</dc:date>
    <item>
      <title>Convert Perl Screpit into Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/convert-perl-screpit-into-shell/m-p/5177083#M459262</link>
      <description>I tried allot to transfer the follwoing code to shell but i couldnt .&lt;BR /&gt;Array is My problem i couldnt code it in shell &lt;BR /&gt;&lt;BR /&gt;#!/opt/OV/bin/Perl/bin/perl&lt;BR /&gt;@nodes = `/opt/OV/bin/OpC/utils/opcnode -list_nodes | grep Name | cut -f 11 -d " " | grep -v MGTSV`;&lt;BR /&gt;chomp(@nodes);&lt;BR /&gt;&lt;BR /&gt;# ping nodes to check theis status &lt;BR /&gt;use Net::Ping ;&lt;BR /&gt;&lt;BR /&gt;$p = Net::Ping-&amp;gt;new("icmp");&lt;BR /&gt;&lt;BR /&gt;        foreach $host (@nodes)&lt;BR /&gt;                {&lt;BR /&gt;                $mon = 1 ;&lt;BR /&gt;                $mon = 0 unless $p-&amp;gt;ping($host, 5);&lt;BR /&gt;                if ( $mon == 0 )&lt;BR /&gt;                        {&lt;BR /&gt;                        $mon = 1;&lt;BR /&gt;                        $mon = 0 unless $p-&amp;gt;ping($host, 15);&lt;BR /&gt;                        }&lt;BR /&gt;                system `/opt/OV/bin/OpC/opcmon check_node_status=$mon -object $host`;&lt;BR /&gt;                }&lt;BR /&gt;$p-&amp;gt;close();&lt;BR /&gt;&lt;BR /&gt;Can anyone help me please</description>
      <pubDate>Sun, 24 May 2009 07:48:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/convert-perl-screpit-into-shell/m-p/5177083#M459262</guid>
      <dc:creator>Salman AlBedaiwi</dc:creator>
      <dc:date>2009-05-24T07:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Perl Screpit into Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/convert-perl-screpit-into-shell/m-p/5177084#M459263</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;why do you want to do this?&lt;BR /&gt;If this script is working: use it as it is or modify it to meet your needs (e.g. setup a list which is NOT a result of an OpC-command).&lt;BR /&gt;&lt;BR /&gt;If this script is not working: tell us about the error message. I suspect this construction:&lt;BR /&gt;system `/opt/OV/bin/OpC/opcmon check_node_status=$mon -object $host`;&lt;BR /&gt;&lt;BR /&gt;The combination of backtic and the system command seems strange: the system would execute the string returned by the opcmon command ...&lt;BR /&gt;&lt;BR /&gt;If you make yourself clear - write it down! - what this script is doing, it won't be a problem to use any (scripting) language to get it working.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Sun, 24 May 2009 13:14:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/convert-perl-screpit-into-shell/m-p/5177084#M459263</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2009-05-24T13:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Perl Screpit into Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/convert-perl-screpit-into-shell/m-p/5177085#M459264</link>
      <description>Hi Salman:&lt;BR /&gt;&lt;BR /&gt;All that is happening here is that a list of hosts is being 'ping'ed; first with a 5-second timeout; and then (if that fails) with a 15-second timeout.  The status of the ping is then passed to an external script called 'opcmon'.&lt;BR /&gt;&lt;BR /&gt;This is definitely more robust in Perl than in a shell script.  The construction of the '@nodes' array is decidedly un-Perlish.  You could do:&lt;BR /&gt;&lt;BR /&gt;my ($fh, @nodes);&lt;BR /&gt;open( $fh, "-|", "opt/OV/bin/OpC/utils/opcnode -list_nodes" ) or die;&lt;BR /&gt;while (&amp;lt;$fh&amp;gt;) {&lt;BR /&gt;    next if /MGTSV/;&lt;BR /&gt;    my @fields = split;&lt;BR /&gt;    push @nodes, $fields[10];&lt;BR /&gt;}&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;That is, Perl counts 0-relative, so field-11 in your spawned process (the 'cut') is field-10 when done in Perl.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sun, 24 May 2009 13:26:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/convert-perl-screpit-into-shell/m-p/5177085#M459264</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-05-24T13:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Perl Screpit into Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/convert-perl-screpit-into-shell/m-p/5177086#M459265</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Oops, I dropped the match for "Name":&lt;BR /&gt;&lt;BR /&gt;my ($fh, @nodes);&lt;BR /&gt;open( $fh, "-|", "opt/OV/bin/OpC/utils/opcnode -list_nodes" ) or die;&lt;BR /&gt;while (&amp;lt;$fh&amp;gt;) {&lt;BR /&gt;    next unless /Name/;&lt;BR /&gt;    my @fields = split;&lt;BR /&gt;    next if /MGTSV/;&lt;BR /&gt;    push @nodes, $fields[10];&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Sun, 24 May 2009 15:08:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/convert-perl-screpit-into-shell/m-p/5177086#M459265</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-05-24T15:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Perl Screpit into Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/convert-perl-screpit-into-shell/m-p/5177087#M459266</link>
      <description>In shell you could use the "set" command to create an array. This works fine when the list is separated by whitespace.&lt;BR /&gt;&lt;BR /&gt;e.g.  set -A hosts ` your code `&lt;BR /&gt;&lt;BR /&gt;This creates an array starting with ${host[0]} and with ${#host[*]} entries. &lt;BR /&gt;&lt;BR /&gt;If the hosts are separated by commas, the you will have to use the FS variable to split it correctly. Make sure to save the previous value before changing, then restore afterwards.&lt;BR /&gt;</description>
      <pubDate>Mon, 25 May 2009 05:51:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/convert-perl-screpit-into-shell/m-p/5177087#M459266</guid>
      <dc:creator>George Spencer_4</dc:creator>
      <dc:date>2009-05-25T05:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Perl Screpit into Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/convert-perl-screpit-into-shell/m-p/5177088#M459267</link>
      <description>I keept the script as it is &lt;BR /&gt;it was taking so many times to run again due to increasing the number of nodes i take out some nodes to let it be checked by other script so i make them working in together and my problem solved &lt;BR /&gt;thank allot for all of you</description>
      <pubDate>Thu, 11 Jun 2009 13:54:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/convert-perl-screpit-into-shell/m-p/5177088#M459267</guid>
      <dc:creator>Salman AlBedaiwi</dc:creator>
      <dc:date>2009-06-11T13:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Perl Screpit into Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/convert-perl-screpit-into-shell/m-p/5177089#M459268</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;you should take look at&lt;BR /&gt;&lt;A href="http://forums13.itrc.hp.com/service/forums/helptips.do?#33" target="_blank"&gt;http://forums13.itrc.hp.com/service/forums/helptips.do?#33&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;It's a good practise here in our forum...&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 12 Jun 2009 06:17:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/convert-perl-screpit-into-shell/m-p/5177089#M459268</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2009-06-12T06:17:35Z</dc:date>
    </item>
  </channel>
</rss>

