1825163 Members
3914 Online
109679 Solutions
New Discussion юеВ

rexec

 
SOLVED
Go to solution
Nobody's Hero
Valued Contributor

rexec

I am trying to use rexec to go from box 'a' to box 'b' but execute a script from 'a' on 'b'. How can I do this? I can execute a command, but how do I run a script from 'a' on 'b'?

Thanks
UNIX IS GOOD
6 REPLIES 6
Helen French
Honored Contributor

Re: rexec

Hi Robert,

You can use:

# remsh
# rexec

See man pages
HTH,
Shiju
Life is a promise, fulfill it!
John Carr_2
Honored Contributor

Re: rexec

Easy

copy the script from server A to sever B then rexec the script on the server B as you would a command. make sure the permissions are set once you have copied the file.

Cheers
John.
harry d brown jr
Honored Contributor
Solution

Re: rexec

You can't have a script on serverA run on serverB unless you push that script to serverB. try this:

ON serverA
# cat uuu

#!/usr/bin/ksh
echo "this is cute"
hostname


# cat /tmp/uuu|remsh serverB /usr/bin/ksh

OUTPUT from serverB
this is cute
serverB
#


live free or die
harry
Live Free or Die
John Carr_2
Honored Contributor

Re: rexec

Hi

another way would be to mount the directory in which the script resides from server B then execute the script.

serverB# mount serverA:/script_dir /serverA_dir

then

serverA# rexec serverB:/serverA_dir/script_name

John.
MANOJ SRIVASTAVA
Honored Contributor

Re: rexec

Hi Robert

To make your question more clear you are essentially looking to run a script on box a which call for something parameters from Box b , remsh is a good command to be used for this
for eg

A# remsh B:bdf will display the bdf as if it is was run on box B.

The same can be done vice versa ie to execute script on BOX A from B

B# remsh A:
Manoj Srivastava
S.K. Chan
Honored Contributor

Re: rexec

The script has to be accessible from any system, you can use NFS mount or manually copy the script over. Then you would run it as such..

# remsh jupiter -l skchan -n /opt/apps/myscript
==> remsh'ing to jupiter as user skchan and run the script in /opt/apps/myscript