LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   rsh script to run on cluster (https://www.linuxquestions.org/questions/linux-networking-3/rsh-script-to-run-on-cluster-155397/)

podollb 03-09-2004 10:18 AM

rsh script to run on cluster
 
If I have a cluster that is secure from the net and I have rsh running on all of them so I can easily communicate with no overhead, how can I write ONE script that can be run and it will dispatch all machines to start a process? My first thought was just a shell script that rsh'd to all the nodes and ran something but after the script rsh's to the first node the script loses control, any idea? For the sake of argument lets say I want to execute an arbirary script or executable that all the nodes have access to via NFS...

bigearsbilly 03-10-2004 09:55 AM

doesn't something like this work:

==============
for machine in <list-of-machines>;do

rsh $machine <script> &

done
===================



or am i being stupid?

regards, billy

podollb 03-10-2004 10:04 AM

That looks like it should, thanks.

bigearsbilly 03-10-2004 10:22 AM

Ideally you'd probably want to batch them, so you get a mail with the output from each, and maybe pass script as a parameter?
so instead probably better is

================
#!/bin/bash

script=<SCRIPT_NAME> # script name OR
script=$1 # passed as parameter

for machine in <LIST>;do

batch <<EOF

/bin/rsh $machine $script
EOF

done
===================
(if batch doesn't work use 'at now' )


then you will get an email for each invocation on each machine
easier to catch errors!


regards, billy


All times are GMT -5. The time now is 07:22 PM.