<?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 error handling remsh/ssh with script's in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-remsh-ssh-with-script-s/m-p/4779114#M640894</link>
    <description>hello,&lt;BR /&gt;&lt;BR /&gt;how it is the best way to handle error codes with command "remsh/ssh" ?&lt;BR /&gt;&lt;BR /&gt;example :&lt;BR /&gt;- i have 2 scripts "main.sh", "sub.sh"&lt;BR /&gt;- "main.sh" starts with remsh "sub.sh"&lt;BR /&gt;- i want handle the errors of "sub.sh" and also i want to get output's of "sub.sh" &lt;BR /&gt;&lt;BR /&gt;main.sh&lt;BR /&gt;remsh server "/tmp/sub.sh /not-found"&lt;BR /&gt;&lt;BR /&gt;sub.sh&lt;BR /&gt;if [ ! -d $1 ]&lt;BR /&gt;then&lt;BR /&gt;echo "dir: $1 not found";exit 1&lt;BR /&gt;fi&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;i tried several versions, i think this is the best ?&lt;BR /&gt;# tee and parse a temporary logfile &lt;BR /&gt;remsh server  -n '( /tmp/sub.sh /not-found; echo "RETURN: $?" )' 2&amp;gt;&amp;amp;1 | tee /tmp/error_log.log&lt;BR /&gt;# return code in last character&lt;BR /&gt;rc=$( sed -n '$s/.*\(.\)$/\1/p'  /tmp/error_log.log )&lt;BR /&gt;&lt;BR /&gt;when i use&lt;BR /&gt;rc=`remsh server  -n '(/tmp/sub.sh /not-found; echo $?)' `&lt;BR /&gt;i can't get the output with "\n" , and a variable has also a limit of 512 bytes ?&lt;BR /&gt;&lt;BR /&gt;regards</description>
    <pubDate>Tue, 19 Apr 2011 10:49:40 GMT</pubDate>
    <dc:creator>Billa-User</dc:creator>
    <dc:date>2011-04-19T10:49:40Z</dc:date>
    <item>
      <title>error handling remsh/ssh with script's</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-remsh-ssh-with-script-s/m-p/4779114#M640894</link>
      <description>hello,&lt;BR /&gt;&lt;BR /&gt;how it is the best way to handle error codes with command "remsh/ssh" ?&lt;BR /&gt;&lt;BR /&gt;example :&lt;BR /&gt;- i have 2 scripts "main.sh", "sub.sh"&lt;BR /&gt;- "main.sh" starts with remsh "sub.sh"&lt;BR /&gt;- i want handle the errors of "sub.sh" and also i want to get output's of "sub.sh" &lt;BR /&gt;&lt;BR /&gt;main.sh&lt;BR /&gt;remsh server "/tmp/sub.sh /not-found"&lt;BR /&gt;&lt;BR /&gt;sub.sh&lt;BR /&gt;if [ ! -d $1 ]&lt;BR /&gt;then&lt;BR /&gt;echo "dir: $1 not found";exit 1&lt;BR /&gt;fi&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;i tried several versions, i think this is the best ?&lt;BR /&gt;# tee and parse a temporary logfile &lt;BR /&gt;remsh server  -n '( /tmp/sub.sh /not-found; echo "RETURN: $?" )' 2&amp;gt;&amp;amp;1 | tee /tmp/error_log.log&lt;BR /&gt;# return code in last character&lt;BR /&gt;rc=$( sed -n '$s/.*\(.\)$/\1/p'  /tmp/error_log.log )&lt;BR /&gt;&lt;BR /&gt;when i use&lt;BR /&gt;rc=`remsh server  -n '(/tmp/sub.sh /not-found; echo $?)' `&lt;BR /&gt;i can't get the output with "\n" , and a variable has also a limit of 512 bytes ?&lt;BR /&gt;&lt;BR /&gt;regards</description>
      <pubDate>Tue, 19 Apr 2011 10:49:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-remsh-ssh-with-script-s/m-p/4779114#M640894</guid>
      <dc:creator>Billa-User</dc:creator>
      <dc:date>2011-04-19T10:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: error handling remsh/ssh with script's</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-remsh-ssh-with-script-s/m-p/4779115#M640895</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;For simple cases (and here I'm going to use 'ssh' in lieu of 'remsh'), you can do:&lt;BR /&gt;&lt;BR /&gt;# ssh -n server /home/billa/sub.sh&lt;BR /&gt;# RC=$?&lt;BR /&gt;# [ ${RC} = 0 ] echo "ok" || echo "bad"&lt;BR /&gt;&lt;BR /&gt;If you want to capture output from the remotely run process you can do so into a file on either the local or the remote host.&lt;BR /&gt;&lt;BR /&gt;# ssh -n server /home/billa/sub.sh &amp;gt; /home/billa/local.log&lt;BR /&gt;&lt;BR /&gt;...or if you quote:&lt;BR /&gt;&lt;BR /&gt;# ssh -n server /home/billa/sub.sh "&amp;gt;" /var/tmp/billa_remote.log&lt;BR /&gt;&lt;BR /&gt;In either case you have the ability to capture the return code as first shown.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 19 Apr 2011 11:39:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-remsh-ssh-with-script-s/m-p/4779115#M640895</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-04-19T11:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: error handling remsh/ssh with script's</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-remsh-ssh-with-script-s/m-p/4779116#M640896</link>
      <description>It looks like you know that remsh(1) doesn't capture the exit status and you need to do that echo.  And ssh(1) works fine.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I can't get the output with "\n"&lt;BR /&gt;&lt;BR /&gt;You should be able to find the last line with the exit status:&lt;BR /&gt;echo "$rc" | tail -1&lt;BR /&gt;&lt;BR /&gt;&amp;gt;a variable has also a limit of 512 bytes?&lt;BR /&gt;&lt;BR /&gt;No, you can have very long strings.</description>
      <pubDate>Wed, 20 Apr 2011 07:42:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-remsh-ssh-with-script-s/m-p/4779116#M640896</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-04-20T07:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: error handling remsh/ssh with script's</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-remsh-ssh-with-script-s/m-p/4779117#M640897</link>
      <description>&amp;gt;a variable has also a limit of 512 bytes?&lt;BR /&gt;can you please tell me, what is the limit of a shell variable ?&lt;BR /&gt;&lt;BR /&gt;the problem of remsh/ssh is to capture the two&lt;BR /&gt;errors of remsh/ssh command:&lt;BR /&gt;&lt;BR /&gt;first : error of remsh&lt;BR /&gt;second : error of remote command &lt;BR /&gt;&lt;BR /&gt;a also to get an output of the error.&lt;BR /&gt;&lt;BR /&gt;regards</description>
      <pubDate>Thu, 21 Apr 2011 05:21:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-remsh-ssh-with-script-s/m-p/4779117#M640897</guid>
      <dc:creator>Billa-User</dc:creator>
      <dc:date>2011-04-21T05:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: error handling remsh/ssh with script's</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-remsh-ssh-with-script-s/m-p/4779118#M640898</link>
      <description>&amp;gt;scan you please tell me, what is the limit of a shell variable?&lt;BR /&gt;&lt;BR /&gt;Limited to heap space, I was able to get about 400 Mb:&lt;BR /&gt;sizeof(var): 209715200&lt;BR /&gt;./itrc_big_var.sh[48]: no space&lt;BR /&gt;&lt;BR /&gt;&amp;gt;second: error of remote command&lt;BR /&gt;&lt;BR /&gt;You did this by that "echo $?" on the remote side.&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Apr 2011 06:01:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-remsh-ssh-with-script-s/m-p/4779118#M640898</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-04-21T06:01:06Z</dc:date>
    </item>
  </channel>
</rss>

