parellel execution of a sub script in mutilple hosts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting parellel execution of a sub script in mutilple hosts
# 1  
Old 11-16-2011
Question parellel execution of a sub script in mutilple hosts

Hi,

I have a main script which will login to different machines one by one and execute the another script as input which will execute some commands after login to the machine. i used while loop and it executes it like ssh to a machine and running the sub script, then moving to the second machines and so on. it is a kind of series activity.

but i want it to do it parellely, then what should i do. please suggest.
i tried to put "&" at the end of while loop so it will start the sub script in each machine at the back end. but it is not working as expected.

my main script code piece is something like,
Code:
while read machine
do
export machine=`echo $machine`
ssh $USER@$machine < $STEPS > $machine_$PRI.log
done < $MACHINE &


Last edited by radoulov; 11-16-2011 at 09:28 AM.. Reason: Code tags!
# 2  
Old 11-16-2011
Code:
while read machine; do
  ssh "$USER@$machine" < "$STEPS" > "$machine_$PRI.log" &
done < "$MACHINE"

This User Gave Thanks to radoulov For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to copy a tar file on a series of remote hosts and untar it on those hosts?

Am trying to copy a tar file onto a series of remote hosts and untar it at the destination. Need to do this without having to do multiple ssh. Actions to perform within a single ssh session via shell script - copy a file - untar at destination (remote host) OS : Linux RHEL6 (3 Replies)
Discussion started by: sankasu
3 Replies

2. Shell Programming and Scripting

Mutilple variable assignment

i have file that contains data as follows 1 2 3 now i need to assign them into three variables a1=1 a2=2 a3=3 Everything should come under a loop. In reality i may have 10 values which has to be assigned to 10 variable. if i have 25 values ( lines) , each should be assigned into... (3 Replies)
Discussion started by: Rajesh_us
3 Replies

3. AIX

aix tcp wrappers hosts.allow hosts.deny?

hi all just installed the netsec.options.tcpwrapper from expansion pack, which used to be a rpm, for my aix 6.1 test box. it is so unpredictable. i set up the hosts.deny as suggested for all and allow the sshd for specific ip addresses/hostnames. the tcpdchk says the hosts allowed and... (0 Replies)
Discussion started by: wf201626
0 Replies

4. Shell Programming and Scripting

downloading mutilple files

hey i have a text file thats filled with info like this $ cat /private/var/lib/apt/lists/idwaneo.org_repo_._Packages Package: org.idwaneo.ldid Priority: optional Section: iDWANEO.org Maintainer: Admin <admin@idwaneo.org> Architecture: iphoneos-arm Version: 610-5 Pre-Depends: dpkg... (1 Reply)
Discussion started by: lewisdenny
1 Replies

5. UNIX for Dummies Questions & Answers

copy mutilple files to mutiple folders

Hi, I just started to learn shell progamming and just can't get my head around the following problem. I need to do the following: I have a folder which contains 100+ subfolders. Inside these subfolders there is one folder named 'Morph' and several jpg's. I need to copy all the files into... (4 Replies)
Discussion started by: M474746
4 Replies

6. Shell Programming and Scripting

Help in running two processes in parellel

I have a script something like this: #!/usr/bin/ksh CLASSPATH=/apps/opt/db2udb/admin/db2bdt/sqllib/java/db2java.zip:/apps/opt/db2udb/admin/db2bdt/sqllib/java/db2jcc.jar:/apps/opt/db2udb/admin/db2bdt/sqllib/function:$CLASSPATH export CLASSPATH ... (7 Replies)
Discussion started by: ss3944
7 Replies

7. UNIX for Dummies Questions & Answers

how to remove mutilple enrty in a single line in unix

Hi, Below is a single line output. subsD,01 02 03 04 05 00 00 00 00 07 00 05,hlr,common,00000000 subsD,01 02 03 04 05 00 00 00 00 07 00 05,hlr,01,baoc|notActive|notInduced,activeAndOperative,notActive,notActive,noneDesignated,0,notActive|00|,notActive|00|,notActive|00|,notActive|00|30|,,... (4 Replies)
Discussion started by: kaprus
4 Replies

8. Shell Programming and Scripting

Problem with SCP parellel processing

Hi All, I am trying to take Bulk Log files from around 24 Remote servers using my shell script. I am using SCP for this. I need to take log files every 15 min, so I am thinking about the parallel processing mechanism in UNIX.The 24 remote machines username,servername reading from properties... (8 Replies)
Discussion started by: scorpio
8 Replies

9. SCO

adding a add on parellel port on S3000 chipset

Our new server is a HCL INFINITY GLOBAL LINE 1700AH ,intel xeon S3000 chipset.It has no onboard parellel port.The vendor is suggesting printing solution through serial port ,but ours is mostly printing work. I would like to know weather an addon parellel port can be added without conflict. OS is... (3 Replies)
Discussion started by: vikramviky
3 Replies

10. UNIX for Dummies Questions & Answers

hosts.allow & hosts.deny

Hi! Im trying to use host.allow & host.deny to resrtic access to my sun machine, but it doesnt seem to work... I want to allow full access from certain IPīs (ssh,http,ftp,etc...) but deny all kind of conections from outsideworld, the way that im doing that is: hosts.allow ALL:127.0.0.1... (2 Replies)
Discussion started by: Sorrento
2 Replies
Login or Register to Ask a Question