Operating System - HP-UX
1830935 Members
2272 Online
110017 Solutions
New Discussion

execute rlogin with local script

 
SOLVED
Go to solution
Cesar Gonzalez_1
Occasional Advisor

execute rlogin with local script


Hi. I??ve got many servers (B,C,D,E..) and a script in A server. Are there any way to execute that script from server A to the others?. If I run remsh, It tries to execute the script from the others servers, not from MY A. It would be bothersome to ftp script in all servers...
Thanks in advance
7 REPLIES 7
ian Dennison
Regular Advisor
Solution

Re: execute rlogin with local script

if you have rights, why not,...

# On server A
for i in B C D E
do
rcp /tmp/script1 $i:/tmp
remsh $i -c "/tmp/script1"
done

If access rights are the other way, instead of an 'rcp', perform a 'remsh -c 'rcp A:/tmp/script1 /tmp''

Share and Enjoy! Ian
Lets do it to them before they do it to us! www.fred.net.nz
Corthouts Carlo
Valued Contributor

Re: execute rlogin with local script

Hi,

You could try to share a single directory from A where you save the script and mount this share on all the other machines.
Then you don't need to ftp the script to the other machines.



Robin Wakefield
Honored Contributor

Re: execute rlogin with local script

Hi Cesar,

If the script is not too complicated, you should be able to:

cat script | remsh host "/sbin/sh"

Rgds, Robin
federico_3
Honored Contributor

Re: execute rlogin with local script

# On all servers B C D E
in your home directory create .rhosts with the following entry:
A username

After this do what listed below:

for i in B C D E
do
rcp /tmp/script1 username@$i:/tmp
remsh $i -l username -n "/tmp/script1"

remsh $i -l username -n " rm /tmp/script1"

done


Bye

Cesar Gonzalez_1
Occasional Advisor

Re: execute rlogin with local script

Thanks guys
Jerry Jaynes
Frequent Advisor

Re: execute rlogin with local script

I have a similar question as well.

I have scripts that I run to add and delete printers, directories, etc. I don't rerally want to copy the script onto the other machines, (leaves a lot of junk for me to clean up). Can I execute the script from server A on servers BCD and E without copying it over? I don't really want to NFS mount drives to my servers due to security considerations.

Suggestions?

Never let 'em see you choke!!
ian Dennison
Regular Advisor

Re: execute rlogin with local script

Jerry,

I don't think you can do this. The essence of the answer to this question was that the Script does have to be on the remote server.

How about creating a 'depot' on all Servers for common scripts? I use '/usr/local/bin' and any scripts I create for one server, I try to rollout to all for future use.

If you really want a clean system with no scripts remaining, federicos answer above gives the perfect solution.

Share and Enjoy! Ian

PS If you post this as a separate question, you can credit people with points for the answers that are given.
Lets do it to them before they do it to us! www.fred.net.nz