<?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: uptime check, awk sub function in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/uptime-check/m-p/6344665#M496441</link>
    <description>&lt;P&gt;Hi Dennis,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for suggestion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; for HOST in $(&amp;lt; /tmp/hostdetails.txt); do&lt;BR /&gt;&amp;nbsp;&amp;nbsp; echo&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ssh -q $HOST uptime | awk -F, '{sub(".*up", "", $1);print $1,$2}'&lt;BR /&gt;&amp;nbsp;&amp;nbsp; done&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am writing a script which checks the uptime of server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am running the script from a centralized server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need all uptime logs from other&amp;nbsp; server to be availble in centralized server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do it ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;above script displays only uptime of all server,but I have to collect all uptime logs in centralized server.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jan 2014 21:23:08 GMT</pubDate>
    <dc:creator>tempsample</dc:creator>
    <dc:date>2014-01-21T21:23:08Z</dc:date>
    <item>
      <title>uptime check</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uptime-check/m-p/6344431#M496439</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;uptime&lt;BR /&gt;&amp;nbsp; 7:40pm&amp;nbsp; up 121 days, 14:47,&amp;nbsp; 1 user,&amp;nbsp; load average: 0.37, 0.30, 0.30&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;uptime | awk -F, '{sub(".*up ",x,$1);print $1,$2}'&lt;BR /&gt;121 days&amp;nbsp; 14:47&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Can you please tell me,How the awk command is working for above uptime.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2014 18:41:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uptime-check/m-p/6344431#M496439</guid>
      <dc:creator>tempsample</dc:creator>
      <dc:date>2014-01-21T18:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: uptime check, awk sub function</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uptime-check/m-p/6344539#M496440</link>
      <description>&lt;P&gt;&amp;gt;How the awk command is working?&lt;/P&gt;&lt;P&gt;&amp;gt;awk -F, '{sub(".*up ", x, $1); print $1, $2}'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This says split fields based on comma: $1="7:40pm&amp;nbsp; up 121 days" $2=" 14:47" $3=" 1 user" ...&lt;/P&gt;&lt;P&gt;Then is uses the sub function on $1 to replace an ERE with the first part of the string, up to "up ".&lt;/P&gt;&lt;P&gt;It replaces it by the variable "x" which is initialized to an empty string.&lt;/P&gt;&lt;P&gt;A better command would be to use a string constant: sub(".*up ", "", $1)&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2014 20:06:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uptime-check/m-p/6344539#M496440</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2014-01-21T20:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: uptime check, awk sub function</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uptime-check/m-p/6344665#M496441</link>
      <description>&lt;P&gt;Hi Dennis,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for suggestion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; for HOST in $(&amp;lt; /tmp/hostdetails.txt); do&lt;BR /&gt;&amp;nbsp;&amp;nbsp; echo&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ssh -q $HOST uptime | awk -F, '{sub(".*up", "", $1);print $1,$2}'&lt;BR /&gt;&amp;nbsp;&amp;nbsp; done&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am writing a script which checks the uptime of server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am running the script from a centralized server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need all uptime logs from other&amp;nbsp; server to be availble in centralized server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do it ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;above script displays only uptime of all server,but I have to collect all uptime logs in centralized server.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2014 21:23:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uptime-check/m-p/6344665#M496441</guid>
      <dc:creator>tempsample</dc:creator>
      <dc:date>2014-01-21T21:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: uptime check, awk sub function</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uptime-check/m-p/6344929#M496442</link>
      <description>&lt;P&gt;&amp;gt;I need all uptime logs from other server to be available in centralized server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you run the script on your central server, you can simply redirect stdout:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; echo $HOST&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;done &amp;gt;&amp;gt; uptime.log&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will append any stdout output in the loop to uptime.log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2014 04:41:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uptime-check/m-p/6344929#M496442</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2014-01-22T04:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: uptime check, awk sub function</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uptime-check/m-p/6354191#M496443</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I have two points to be clarified.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First Point&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am running the script from solaris server to check uptime status of hp-ux server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;for HOST in $(&amp;lt; /tmp/hostdetails.txt); do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when I use above format,I am getting error : syntax error $ unexpected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it is running fine with `cat /tmp/hostdetails.txt`&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to know why i am getting syntax error for above cmd.&lt;BR /&gt;&lt;BR /&gt;Second Point :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for example if a server is down or decommissioned,so when i run uptime script ,it gets waiting to get server status,but actually server is down.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to know how can i avoid this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2014 07:37:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uptime-check/m-p/6354191#M496443</guid>
      <dc:creator>tempsample</dc:creator>
      <dc:date>2014-01-28T07:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: uptime check, awk sub function</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uptime-check/m-p/6355239#M496444</link>
      <description>&lt;P&gt;&amp;gt;I am running the script from solaris server to check uptime status of HP-UX server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then your question doesn't belong in an HP-UX forum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;when I use above format, I am getting error: syntax error $ unexpected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume that Solaris has some real shells, ksh/Posix?&amp;nbsp; And not scummy csh/tcsh nor Bourne sh.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;for example if a server is down or decommissioned&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See your other topic for setting ssh timeouts:&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://h30499.www3.hp.com/t5/Languages-and-Scripting/setting-timeout-value/m-p/6346969#M46743"&gt;http://h30499.www3.hp.com/t5/Languages-and-Scripting/setting-timeout-value/m-p/6346969#M46743&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2014 05:14:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uptime-check/m-p/6355239#M496444</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2014-01-29T05:14:28Z</dc:date>
    </item>
  </channel>
</rss>

