<?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: Strange shell script behaviour in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/strange-shell-script-behaviour/m-p/3747769#M101609</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;      Can you try "ssh" with "-T" option.&lt;BR /&gt;&lt;BR /&gt;      This is what I read related to "-T" option...&lt;BR /&gt;&lt;BR /&gt;"-T      Disable pseudo-tty allocation."&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Senthil Kumar .A&lt;BR /&gt;</description>
    <pubDate>Fri, 10 Mar 2006 00:01:19 GMT</pubDate>
    <dc:creator>Senthil Kumar .A_1</dc:creator>
    <dc:date>2006-03-10T00:01:19Z</dc:date>
    <item>
      <title>Strange shell script behaviour</title>
      <link>https://community.hpe.com/t5/operating-system-linux/strange-shell-script-behaviour/m-p/3747765#M101605</link>
      <description>I am writing some script to monitor CPU usage of the remote host using SSH.  If the CPU is less than 10% idle it will send out an alert via email.&lt;BR /&gt;&lt;BR /&gt;Apparently my script only work if I run it in foreground but not cron.  It seem to be something to do with the remote ssh execution, the output was not captured.&lt;BR /&gt;&lt;BR /&gt;PATH=/usr/bin:/opt/openssh/bin:&lt;BR /&gt;export PATH&lt;BR /&gt;rm -f /tmp/sarcheck&lt;BR /&gt;ssh username@hostname "sar -u 30 5" &amp;gt; /tmp/sarcheck&lt;BR /&gt;IDLE=`cat /tmp/sarcheck | grep Average | awk '{print $5}'`&lt;BR /&gt;function func_send_email&lt;BR /&gt;{&lt;BR /&gt;        (&lt;BR /&gt;        echo "To:myemail@my.com"&lt;BR /&gt;        echo "Subject:CPU Alert idle"                                                                                                                      &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;&lt;BR /&gt;please advise</description>
      <pubDate>Thu, 09 Mar 2006 09:10:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/strange-shell-script-behaviour/m-p/3747765#M101605</guid>
      <dc:creator>kholikt</dc:creator>
      <dc:date>2006-03-09T09:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Strange shell script behaviour</title>
      <link>https://community.hpe.com/t5/operating-system-linux/strange-shell-script-behaviour/m-p/3747766#M101606</link>
      <description>The first issue I see is with your PATH.  You only have /usr/bin and sar lives in /usr/sbin.  You need to specify full path names of all commands in a cron script or explicitly define a full PATH variable.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Thu, 09 Mar 2006 09:25:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/strange-shell-script-behaviour/m-p/3747766#M101606</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2006-03-09T09:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Strange shell script behaviour</title>
      <link>https://community.hpe.com/t5/operating-system-linux/strange-shell-script-behaviour/m-p/3747767#M101607</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;For looking problems with scrits running by cron, try redirect errors messages e default output:&lt;BR /&gt;&lt;BR /&gt;0,15,30,45 * * * * /your_script.sh &amp;gt;/tmp/output.txt 2&amp;gt;/errors.txt&lt;BR /&gt;&lt;BR /&gt;You can put "set -x" in the begin of the script for debug.&lt;BR /&gt;&lt;BR /&gt;Remember when you submit script for cron, is possible see this output:&lt;BR /&gt;&lt;BR /&gt;"warning: commands will be executed using /usr/bin/sh"&lt;BR /&gt;&lt;BR /&gt;Sometimes a script run well in korn shell, but not run so well in posix shell.&lt;BR /&gt;&lt;BR /&gt;Schimidt</description>
      <pubDate>Thu, 09 Mar 2006 09:43:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/strange-shell-script-behaviour/m-p/3747767#M101607</guid>
      <dc:creator>Carlos Roberto Schimidt</dc:creator>
      <dc:date>2006-03-09T09:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: Strange shell script behaviour</title>
      <link>https://community.hpe.com/t5/operating-system-linux/strange-shell-script-behaviour/m-p/3747768#M101608</link>
      <description>The error come out you have no controlling tty&lt;BR /&gt;&lt;BR /&gt;+ rm -f /tmp/sarcheck&lt;BR /&gt;+ ssh user@hostname sar -u 30 5&lt;BR /&gt;+ 1&amp;gt; /tmp/sarcheck&lt;BR /&gt;You have no controlling tty.  Cannot read passphrase.&lt;BR /&gt;+ + cat /tmp/sarcheck&lt;BR /&gt;+ grep Average&lt;BR /&gt;+ awk {print $5}&lt;BR /&gt;IDLE=&lt;BR /&gt;+ echo&lt;BR /&gt;+ 1&amp;gt;&amp;gt; /tmp/cpu.log&lt;BR /&gt;+ [ -lt 10 ]&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Mar 2006 21:08:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/strange-shell-script-behaviour/m-p/3747768#M101608</guid>
      <dc:creator>kholikt</dc:creator>
      <dc:date>2006-03-09T21:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Strange shell script behaviour</title>
      <link>https://community.hpe.com/t5/operating-system-linux/strange-shell-script-behaviour/m-p/3747769#M101609</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;      Can you try "ssh" with "-T" option.&lt;BR /&gt;&lt;BR /&gt;      This is what I read related to "-T" option...&lt;BR /&gt;&lt;BR /&gt;"-T      Disable pseudo-tty allocation."&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Senthil Kumar .A&lt;BR /&gt;</description>
      <pubDate>Fri, 10 Mar 2006 00:01:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/strange-shell-script-behaviour/m-p/3747769#M101609</guid>
      <dc:creator>Senthil Kumar .A_1</dc:creator>
      <dc:date>2006-03-10T00:01:19Z</dc:date>
    </item>
  </channel>
</rss>

