<?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: Executing a Remote Shell Script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022620#M761978</link>
    <description>This time I get:&lt;BR /&gt;&lt;BR /&gt;sh: /home/gp7200/550-PROD/scripts/callPRODscripts 10.31.152.94 3424 7374:  not found.&lt;BR /&gt;&lt;BR /&gt;Modified the script to have:&lt;BR /&gt;&lt;BR /&gt;remsh server -l user -n "'/full/name/of/path/callscript $host $dbase $rdg'"</description>
    <pubDate>Fri, 12 Jan 2007 11:29:09 GMT</pubDate>
    <dc:creator>Andrew Huizenga</dc:creator>
    <dc:date>2007-01-12T11:29:09Z</dc:date>
    <item>
      <title>Executing a Remote Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022617#M761975</link>
      <description>I'm attempting to run a remote shell script from my server on another workstation, but I keep getting the "not found" message anytime I attempt to run the script from my server, but can run it fine on the other server when I'm logged in.  I'm using the following line in a local script to try and run the script remotely:&lt;BR /&gt;&lt;BR /&gt;remsh server -l user -n "cd /full/path/of/script/;ls;'callscript $host $dbase $rdg'"&lt;BR /&gt;&lt;BR /&gt;When the "ls" is called I can see the "callscript", but when the script is actually called I get:&lt;BR /&gt;&lt;BR /&gt;sh: callscript host dbase rdg:  not found.&lt;BR /&gt;&lt;BR /&gt;Where host, dbase, rdg are values entered by the user.  Now, I can take that exact line "callscript host dbase rdg" and it will run succesfully while I'm logged into the remote workstation.  The workstations .rhosts file is updated with:&lt;BR /&gt;&lt;BR /&gt;myserver myusername&lt;BR /&gt;+ myusername&lt;BR /&gt;&lt;BR /&gt;Any advice on what I need to add to my local script to run the remote script successfully?&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Fri, 12 Jan 2007 11:15:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022617#M761975</guid>
      <dc:creator>Andrew Huizenga</dc:creator>
      <dc:date>2007-01-12T11:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a Remote Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022618#M761976</link>
      <description>Instead of callscript use full path:&lt;BR /&gt;&lt;BR /&gt;/full/path/of/script/callscript &lt;BR /&gt;&lt;BR /&gt;. and /full/path/of/script/ are in in the default PATH - and . should NEVER be.&lt;BR /&gt;&lt;BR /&gt;Rdgs...Geoff</description>
      <pubDate>Fri, 12 Jan 2007 11:21:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022618#M761976</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2007-01-12T11:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a Remote Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022619#M761977</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;change your command line to use the pathname and drop the wrong usage of the single quotes:&lt;BR /&gt;&lt;BR /&gt;remsh server -l user -n "cd /full/path/of/script/;ls;./callscript $host $dbase $rdg"&lt;BR /&gt;&lt;BR /&gt;Your attempt tries to locate a program&lt;BR /&gt;'callscript host dbase rdg' (spaces are part of the program name!) via the PATH variable.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 12 Jan 2007 11:28:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022619#M761977</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2007-01-12T11:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a Remote Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022620#M761978</link>
      <description>This time I get:&lt;BR /&gt;&lt;BR /&gt;sh: /home/gp7200/550-PROD/scripts/callPRODscripts 10.31.152.94 3424 7374:  not found.&lt;BR /&gt;&lt;BR /&gt;Modified the script to have:&lt;BR /&gt;&lt;BR /&gt;remsh server -l user -n "'/full/name/of/path/callscript $host $dbase $rdg'"</description>
      <pubDate>Fri, 12 Jan 2007 11:29:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022620#M761978</guid>
      <dc:creator>Andrew Huizenga</dc:creator>
      <dc:date>2007-01-12T11:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a Remote Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022621#M761979</link>
      <description>Peter-&lt;BR /&gt;&lt;BR /&gt;I modified the line to:&lt;BR /&gt;&lt;BR /&gt;remsh server -l user -n "/full/name/of/path/callscript $host $dbase $rdg"&lt;BR /&gt;&lt;BR /&gt;And now receive:&lt;BR /&gt;&lt;BR /&gt;/full/name/of/path/callscript: expect:  not found.&lt;BR /&gt;&lt;BR /&gt;In the remote script "callscript", I'm using the "expect" function- is there something in my local script I need to add to specify a location of "expect"?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Jan 2007 11:34:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022621#M761979</guid>
      <dc:creator>Andrew Huizenga</dc:creator>
      <dc:date>2007-01-12T11:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a Remote Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022622#M761980</link>
      <description>Hi Andrew,&lt;BR /&gt;&lt;BR /&gt;it is good practise to check for the existence of non-standard tools, which you are using in scripts.&lt;BR /&gt;If its a ksh script, you can do it like this:&lt;BR /&gt;#&lt;BR /&gt;if ! whence expect &amp;gt;/dev/null&lt;BR /&gt;then PATH=$PATH:/path/where/tools_are_found&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;If you have a setup of an environment commonly used after a normal login (e.g. /usr/local/env/common.env), you could source it explicitly in your remsh-command:&lt;BR /&gt;&lt;BR /&gt;remsh server -l user -n ". /usr/local/env/common.env; cd /full/path/of/script/;ls;./callscript $host $dbase $rdg"&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 12 Jan 2007 12:01:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022622#M761980</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2007-01-12T12:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a Remote Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022623#M761981</link>
      <description>I guess I'm a bit confused- when I'm using remsh, I thought it was just the same as being logged into the remote server and running the script.  Is it assuming the the "expect" function on the remote server is in the same location as my local server?</description>
      <pubDate>Fri, 12 Jan 2007 12:13:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022623#M761981</guid>
      <dc:creator>Andrew Huizenga</dc:creator>
      <dc:date>2007-01-12T12:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a Remote Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022624#M761982</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;you can check:&lt;BR /&gt;&lt;BR /&gt;echo $PATH&lt;BR /&gt;remsh -l user -n 'echo $PATH'&lt;BR /&gt;&lt;BR /&gt;Reasons:&lt;BR /&gt;- it's another user, you are connected to&lt;BR /&gt;- it's a remote server and your toolpath may vary&lt;BR /&gt;- it's not an interactive session you are using, so some setting may not be done&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 12 Jan 2007 12:25:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022624#M761982</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2007-01-12T12:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a Remote Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022625#M761983</link>
      <description>Okay.  When I run the echo $PATH on the local server, and then the remote server using remsh, I get the same result.  However, when I log into the other server (as a different user not the same as my local server), I get a different result.&lt;BR /&gt;&lt;BR /&gt;I did a "which expect" on both servers, and the expect function appears to be located in the same directory on both (/apps/bin/expect).&lt;BR /&gt;&lt;BR /&gt;I guess I'm still confused as to why I'm getting that "not found" message if "expect" is located in the same place on both servers.</description>
      <pubDate>Fri, 12 Jan 2007 14:19:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022625#M761983</guid>
      <dc:creator>Andrew Huizenga</dc:creator>
      <dc:date>2007-01-12T14:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a Remote Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022626#M761984</link>
      <description>the question is really "what is $PATH for the user id, on the remote server, that is attempting to run the command"&lt;BR /&gt;&lt;BR /&gt;usually, I just set the path to what I need it to be in the script and be done with it.............</description>
      <pubDate>Fri, 12 Jan 2007 14:39:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022626#M761984</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2007-01-12T14:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a Remote Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022627#M761985</link>
      <description>In your script - hard code the calls to other apps:&lt;BR /&gt;&lt;BR /&gt;/usr/local/bin/expect &lt;BR /&gt;&lt;BR /&gt;not &lt;BR /&gt;&lt;BR /&gt;expect&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Fri, 12 Jan 2007 15:04:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022627#M761985</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2007-01-12T15:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a Remote Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022628#M761986</link>
      <description>Thanks, hardcoding worked!</description>
      <pubDate>Fri, 12 Jan 2007 15:18:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022628#M761986</guid>
      <dc:creator>Andrew Huizenga</dc:creator>
      <dc:date>2007-01-12T15:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a Remote Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022629#M761987</link>
      <description>No worries Andrew.&lt;BR /&gt;&lt;BR /&gt;PS - welcome to the forums!&lt;BR /&gt;&lt;BR /&gt;Please have a read through:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/helptips.do?#28" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/helptips.do?#28&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Basically, points help people determine the relevance of the answer when they search the ITRC for similar questions.&lt;BR /&gt;&lt;BR /&gt;Also, it is a good idea to close a thread when you are satisfied with the answers.&lt;BR /&gt;&lt;BR /&gt;Thanks...Geoff</description>
      <pubDate>Fri, 12 Jan 2007 16:40:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022629#M761987</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2007-01-12T16:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a Remote Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022630#M761988</link>
      <description>Good script writing dictates that NO assumptions are made about the environment. The remsh environment is not set as if you logged in because remsh does not login -- instead, it validates that your request has been validated and then sets a minimal environment. The same is true for cron and other batch operations. So there are three mandatory statements at the beginning of every script you write:&lt;BR /&gt; &lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;set -u&lt;BR /&gt;export PATH=/usr/bin:/usr/contrib/bin....&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;The first defines the correct shell to use for interpreting the script. The second line prevents spelling errors for variables by stopping the script. The third defines the PATH required for this script. You add only the paths needed for your script. This PATH only exists inside your script. You can hardcode full pathnames in your scripts but it is a lot of extra work -- that's why defining PATH locally makes more sense. Additionally, PATH is a potential security risk so your scripts should never use the currently defined PATH value.&lt;BR /&gt; &lt;BR /&gt;You also look at your required environment variables. To see what is currently defined, use the env command, then pick the ones needed by your script.</description>
      <pubDate>Fri, 12 Jan 2007 17:35:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022630#M761988</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2007-01-12T17:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a Remote Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022631#M761989</link>
      <description>Thanks!</description>
      <pubDate>Tue, 16 Jan 2007 13:57:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/executing-a-remote-shell-script/m-p/5022631#M761989</guid>
      <dc:creator>Andrew Huizenga</dc:creator>
      <dc:date>2007-01-16T13:57:11Z</dc:date>
    </item>
  </channel>
</rss>

