<?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: what wrong with my script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747406#M787221</link>
    <description>Hi,&lt;BR /&gt;assuming you use key-authentication in that ssh connection with the default environment with HOME being not set in cron, ssh (which should be fully quallified as already said) needs to know where the key-files is.&lt;BR /&gt;&lt;BR /&gt;-i file     Identity for public key authentication (default: ~/.ssh/identity)&lt;BR /&gt;&lt;BR /&gt;with "~" beinig a substititute for $HOME.&lt;BR /&gt;&lt;BR /&gt;Specify the key file with the "-i" option or set &lt;BR /&gt;export HOME=....&lt;BR /&gt;prior calling ssh&lt;BR /&gt;&lt;BR /&gt;Good luck !&lt;BR /&gt;Volker</description>
    <pubDate>Thu, 09 Mar 2006 13:31:39 GMT</pubDate>
    <dc:creator>Volker Borowski</dc:creator>
    <dc:date>2006-03-09T13:31:39Z</dc:date>
    <item>
      <title>what wrong with my script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747396#M787211</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I am writing some script to monitor the CPU usage of a remote machine.  If the CPU is busy then I will get an email.  Apparently I notice that the IDLE value is always empty.  If I run the script it seem to be okay&lt;BR /&gt;&lt;BR /&gt;IDLE=`ssh user@hostname sar -u 1 5 | grep Average | awk '{print $5}'`&lt;BR /&gt;function func_send_email&lt;BR /&gt;{&lt;BR /&gt;        (&lt;BR /&gt;        echo "To:myemail@mydomain.com"&lt;BR /&gt;        echo "Subject:CPU Alert"&lt;BR /&gt;        ) | /usr/sbin/sendmail -t&lt;BR /&gt;}&lt;BR /&gt;echo $IDLE &amp;gt;&amp;gt; /tmp/cpu.log&lt;BR /&gt;if [ $IDLE -lt "10" ]&lt;BR /&gt;then&lt;BR /&gt;        echo "Warning High CPU more than 90%"&lt;BR /&gt;        func_send_email&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Mar 2006 21:02:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747396#M787211</guid>
      <dc:creator>kholikt</dc:creator>
      <dc:date>2006-03-08T21:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: what wrong with my script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747397#M787212</link>
      <description>Seems to work for me - maybe try /usr/bin/awk ?&lt;BR /&gt;&lt;BR /&gt;Did you set a shell at the start?&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Mar 2006 23:27:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747397#M787212</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-03-08T23:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: what wrong with my script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747398#M787213</link>
      <description>I have tried also I think my script work if I just run it manually.  It won't work if I put it in cron.  The IDLE value seems to be empty</description>
      <pubDate>Thu, 09 Mar 2006 02:13:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747398#M787213</guid>
      <dc:creator>kholikt</dc:creator>
      <dc:date>2006-03-09T02:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: what wrong with my script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747399#M787214</link>
      <description>Required varibales. Do export IDLE="whatevr goes here"&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Mar 2006 02:18:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747399#M787214</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2006-03-09T02:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: what wrong with my script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747400#M787215</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;    Please be aware that when cron runs your script, it is not in the shell with profile/.profile executed. So you have 2 choices. One either mention Obsolute path names to all your commands are define a PATH variable explicitly.&lt;BR /&gt;&lt;BR /&gt;   Along with RAC's suggestion of exporting the IDLE variable, Please also define a PATH variable.. You can see it defined in /etc/profile, ~/.profile or /etc/PATH file..&lt;BR /&gt;&lt;BR /&gt;In my example I would include the following lines in my script.&lt;BR /&gt;&lt;BR /&gt;PATH=/usr/bin:/usr/contrib/bin:/opt/local/bin:/opt/perf/bin:/opt/OV/bin/OpC:/opt/hparray/bin:/opt/graphics/common/bin:/usr/sbin/diag/contrib:/opt/h&lt;BR /&gt;pnpl//bin:/opt/ansic/bin:/opt/langtools/bin:/opt/imake/bin:/opt/OV/bin:/opt/ignite/bin:/opt/resmon/bin:.&lt;BR /&gt;&lt;BR /&gt;export PATH&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Senthil Kumar .A</description>
      <pubDate>Thu, 09 Mar 2006 02:29:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747400#M787215</guid>
      <dc:creator>Senthil Kumar .A_1</dc:creator>
      <dc:date>2006-03-09T02:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: what wrong with my script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747401#M787216</link>
      <description>I have checked this is something to do with this&lt;BR /&gt;&lt;BR /&gt;ssh user@hostname sar -u 1 5 | grep Average | awk '{print $5}&lt;BR /&gt;&lt;BR /&gt;the remote execution of command won't work in my script if it is running in background.&lt;BR /&gt;&lt;BR /&gt;Any more input</description>
      <pubDate>Thu, 09 Mar 2006 04:07:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747401#M787216</guid>
      <dc:creator>kholikt</dc:creator>
      <dc:date>2006-03-09T04:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: what wrong with my script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747402#M787217</link>
      <description>First you could avoid the redundant pipe to grep if you put&lt;BR /&gt;e.g.&lt;BR /&gt; &lt;BR /&gt;IDLE=`ssh user@hostname sar -u 1 5|awk '$1~/verage/{print$5}'`&lt;BR /&gt; &lt;BR /&gt;But that's only cosmetic.&lt;BR /&gt;However, there's a subtle difference if you quote the pipe or don't, as you have done.&lt;BR /&gt;e.g.&lt;BR /&gt;... sar -u 1 5 \| awk ...&lt;BR /&gt;In the first case (i.e. quoted pipe) the parsing is done on the remote host,&lt;BR /&gt;while in the latter awk is called on the local host.&lt;BR /&gt;Apropos quotes,&lt;BR /&gt;you also may have a quoting issue, especially with awk's execution block.&lt;BR /&gt;Sometimes some weird quoting is necessary.&lt;BR /&gt;In such cases I usually play at the shell to see how tokens get expanded until I fixed any quoting issues.&lt;BR /&gt;  &lt;BR /&gt;What return code is reported in /var/adm/cron/log for your job?&lt;BR /&gt;Does the cronjob's user receive a mail of stdout and stderr on the local host? &lt;BR /&gt; &lt;BR /&gt;How does your local user (i.e. the uid the cronjob runs under) authenticate with the remote host?&lt;BR /&gt;(e.g. Rhosts vs. RSAPubKey)&lt;BR /&gt;Maybe extra reference to the right keys is necessary (viz. ssh -i ...)? &lt;BR /&gt; &lt;BR /&gt;Maybe split the job into single tasks for debugging.&lt;BR /&gt;E.g. first run the ssh sar command as cron or at job to see if the remote command gets executed and its output is caught.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Mar 2006 05:09:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747402#M787217</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2006-03-09T05:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: what wrong with my script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747403#M787218</link>
      <description>If it works command line but not in cron - then it is a PATH/env issue.&lt;BR /&gt;&lt;BR /&gt;You need to run commands explicitly - IE give the full path...&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Thu, 09 Mar 2006 09:34:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747403#M787218</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-03-09T09:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: what wrong with my script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747404#M787219</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Why dont use net-snmp? Is possible use command snmpget for get information from another host.&lt;BR /&gt;&lt;BR /&gt;Download "HP-UX Internet Express for HP-UX 11i version 1"&lt;BR /&gt;&lt;BR /&gt;See description:&lt;BR /&gt;&lt;BR /&gt;"HP-UX Internet Express version A.06.00 for HP-UX 11i version 1 contains two sets of components. The first set is a collection of HP-UX Internet Express Open Source Web, Internet, and security components, which have been tested and qualified on HP-UX. The second set of components is a selection of software products available on HP-UX 11i version 1 Operating Environments (OEs)."&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Schimidt&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Mar 2006 11:59:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747404#M787219</guid>
      <dc:creator>Carlos Roberto Schimidt</dc:creator>
      <dc:date>2006-03-09T11:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: what wrong with my script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747405#M787220</link>
      <description>Remember, if your host who send email dont have much idle cpu, is possible the email not send immediatilly.&lt;BR /&gt;&lt;BR /&gt;See /etc/mail/sendmail.cf&lt;BR /&gt;&lt;BR /&gt;#      In order to limit load on a very busy system, sendmail can be           #&lt;BR /&gt;#      configured to queue up low priority messages rather than attempt        #&lt;BR /&gt;#      delivery immediately if the five-minute load average is greater         #&lt;BR /&gt;#      than some integer value, by default 8.  This value is defined on        #&lt;BR /&gt;#      the line beginning O QueueLA=.</description>
      <pubDate>Thu, 09 Mar 2006 12:03:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747405#M787220</guid>
      <dc:creator>Carlos Roberto Schimidt</dc:creator>
      <dc:date>2006-03-09T12:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: what wrong with my script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747406#M787221</link>
      <description>Hi,&lt;BR /&gt;assuming you use key-authentication in that ssh connection with the default environment with HOME being not set in cron, ssh (which should be fully quallified as already said) needs to know where the key-files is.&lt;BR /&gt;&lt;BR /&gt;-i file     Identity for public key authentication (default: ~/.ssh/identity)&lt;BR /&gt;&lt;BR /&gt;with "~" beinig a substititute for $HOME.&lt;BR /&gt;&lt;BR /&gt;Specify the key file with the "-i" option or set &lt;BR /&gt;export HOME=....&lt;BR /&gt;prior calling ssh&lt;BR /&gt;&lt;BR /&gt;Good luck !&lt;BR /&gt;Volker</description>
      <pubDate>Thu, 09 Mar 2006 13:31:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-wrong-with-my-script/m-p/3747406#M787221</guid>
      <dc:creator>Volker Borowski</dc:creator>
      <dc:date>2006-03-09T13:31:39Z</dc:date>
    </item>
  </channel>
</rss>

