<?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: Test return value from remsh'd script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/test-return-value-from-remsh-d-script/m-p/2642140#M771111</link>
    <description>Hamish&lt;BR /&gt;&lt;BR /&gt;It depends what your remote script does.  If it does not have anything doing to standard out, you can do something like this&lt;BR /&gt;&lt;BR /&gt;VAL=`remsh node script.sh`&lt;BR /&gt;&lt;BR /&gt;#####&lt;BR /&gt;Script.sh&lt;BR /&gt;code&lt;BR /&gt;...&lt;BR /&gt;echo $RETRUN_VAL&lt;BR /&gt;&lt;BR /&gt;or you could do something like this&lt;BR /&gt;&lt;BR /&gt;remsh node script.sh&lt;BR /&gt;VAL=`remsh cat ret_file`&lt;BR /&gt;&lt;BR /&gt;#####&lt;BR /&gt;Script.sh&lt;BR /&gt;code&lt;BR /&gt;...&lt;BR /&gt;echo $RETURN_VAL &amp;gt; ret_file</description>
    <pubDate>Thu, 10 Jan 2002 13:55:39 GMT</pubDate>
    <dc:creator>Jeff Machols</dc:creator>
    <dc:date>2002-01-10T13:55:39Z</dc:date>
    <item>
      <title>Test return value from remsh'd script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-return-value-from-remsh-d-script/m-p/2642138#M771109</link>
      <description>We have various scripts that need to remsh to another server to run a seperate script.  These processes are automated, so we need to test that the remote script has successfuly completed.  Either by a return code of '0' or something.  If you ran an echo $? after the remsh command it is only going to test that the actual 'remsh' command completed.  What is the easiest and most robust way to test such a thing?  Logging  all the output from the remote script, and then grep for some value on that server?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Hamish&lt;BR /&gt;Has anyone experienced the same queries</description>
      <pubDate>Thu, 10 Jan 2002 13:47:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-return-value-from-remsh-d-script/m-p/2642138#M771109</guid>
      <dc:creator>Hamish Tunley</dc:creator>
      <dc:date>2002-01-10T13:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Test return value from remsh'd script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-return-value-from-remsh-d-script/m-p/2642139#M771110</link>
      <description>Have your script that's running on the remote host log the errors and return values you want, then rcp them back after you remsh, then grep out the values you need.&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Thu, 10 Jan 2002 13:53:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-return-value-from-remsh-d-script/m-p/2642139#M771110</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-01-10T13:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Test return value from remsh'd script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-return-value-from-remsh-d-script/m-p/2642140#M771111</link>
      <description>Hamish&lt;BR /&gt;&lt;BR /&gt;It depends what your remote script does.  If it does not have anything doing to standard out, you can do something like this&lt;BR /&gt;&lt;BR /&gt;VAL=`remsh node script.sh`&lt;BR /&gt;&lt;BR /&gt;#####&lt;BR /&gt;Script.sh&lt;BR /&gt;code&lt;BR /&gt;...&lt;BR /&gt;echo $RETRUN_VAL&lt;BR /&gt;&lt;BR /&gt;or you could do something like this&lt;BR /&gt;&lt;BR /&gt;remsh node script.sh&lt;BR /&gt;VAL=`remsh cat ret_file`&lt;BR /&gt;&lt;BR /&gt;#####&lt;BR /&gt;Script.sh&lt;BR /&gt;code&lt;BR /&gt;...&lt;BR /&gt;echo $RETURN_VAL &amp;gt; ret_file</description>
      <pubDate>Thu, 10 Jan 2002 13:55:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-return-value-from-remsh-d-script/m-p/2642140#M771111</guid>
      <dc:creator>Jeff Machols</dc:creator>
      <dc:date>2002-01-10T13:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: Test return value from remsh'd script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-return-value-from-remsh-d-script/m-p/2642141#M771112</link>
      <description>Hi Hamish:&lt;BR /&gt;&lt;BR /&gt;Yes that question has come up many times. I will simply duplicate one of my earlier posts. &lt;BR /&gt;NOTE: This is the most general solution to the problem when you also need STDOUT and STDERR from your remsh'ed process. i.e. This method works in all cases.&lt;BR /&gt;&lt;BR /&gt;The remsh exit code of 0 only means that the script was able to be launched. The exit status of the remote command is not returned. There is a workaround I have used for a long time. &lt;BR /&gt;&lt;BR /&gt;REM_ERR_FILE=/var/tmp/x${$}.err &lt;BR /&gt;remsh remote_host my_command $REM_ERR_FILE &lt;BR /&gt;LOCAL_STAT=$? &lt;BR /&gt;&lt;BR /&gt;$LOCAL_STAT only tells us about the success of remsh itself &lt;BR /&gt;&lt;BR /&gt;Now my_command on the remote host can get the &lt;BR /&gt;value of $REM_ERR_FILE; any status values you are interested in can be written to that file by your script on the remote host. &lt;BR /&gt;&lt;BR /&gt;When the remsh command finishes you can then &lt;BR /&gt;REM_STAT=`remsh remote_host cat ${REM_ERR_FILE}` &lt;BR /&gt;to capture the remote commands status. (You should then issue a final remsh to remove the $REM_ERR_FILE.) &lt;BR /&gt;&lt;BR /&gt;It's a little complicated but it does work. Since we generate a process id dependent filename on the local host, you don't have to worry about filename collision when multiple instances are running. This method also leaves stderr and stdout for their normal use. &lt;BR /&gt;&lt;BR /&gt;You can serach the Forums for remsh and status for other methods.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay&lt;BR /&gt;</description>
      <pubDate>Thu, 10 Jan 2002 13:56:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-return-value-from-remsh-d-script/m-p/2642141#M771112</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-01-10T13:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Test return value from remsh'd script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-return-value-from-remsh-d-script/m-p/2642142#M771113</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Here is an example i use (in a Ksh Shell). The Idea: Put the value of the return remsh in a variable, and test that variable afterwards.&lt;BR /&gt;&lt;BR /&gt;CMD_RELEASE_DSK="/usr/bin/remsh $SERVEUR_CIBLE -l root -n '${SHELL_CONTROL_SERVEUR_CIBLE} RELEASE ; echo $?'"&lt;BR /&gt;RESULT=`eval ${CMD_RELEASE_DSK}`&lt;BR /&gt;if [ $RESULT -eq 0 ] ; then&lt;BR /&gt;echo "Ok"&lt;BR /&gt;else&lt;BR /&gt;echo "Ko"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;It may help&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;&lt;BR /&gt;PJA.</description>
      <pubDate>Thu, 10 Jan 2002 13:56:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-return-value-from-remsh-d-script/m-p/2642142#M771113</guid>
      <dc:creator>JACQUET</dc:creator>
      <dc:date>2002-01-10T13:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Test return value from remsh'd script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-return-value-from-remsh-d-script/m-p/2642143#M771114</link>
      <description>Hi Hamish,&lt;BR /&gt;&lt;BR /&gt;For a one-off return code check:&lt;BR /&gt;&lt;BR /&gt;remsh host "your_script;echo $?" &amp;gt; /tmp/returncode&lt;BR /&gt;&lt;BR /&gt;Then grep /tmp/returncode locally.&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Thu, 10 Jan 2002 13:58:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-return-value-from-remsh-d-script/m-p/2642143#M771114</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-01-10T13:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Test return value from remsh'd script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/test-return-value-from-remsh-d-script/m-p/2642144#M771115</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Robin's solution needs a modification :&lt;BR /&gt;&lt;BR /&gt;remsh host "your_script;echo \$?" &amp;gt; /tmp/returncode&lt;BR /&gt;&lt;BR /&gt;or use simple quotes instead.</description>
      <pubDate>Fri, 27 Oct 2006 11:25:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/test-return-value-from-remsh-d-script/m-p/2642144#M771115</guid>
      <dc:creator>marc seguin</dc:creator>
      <dc:date>2006-10-27T11:25:17Z</dc:date>
    </item>
  </channel>
</rss>

