Re: "parallelizing" a script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Send then stderr and stdout to a script that prints the machine name in front of each line. :

ssh machine1 $1 2>&1 | \
	( while read line ; do echo machine1:$line ; done)
...

-iulian

lasalle@xxxxxxxx wrote:
I have script that I use to effect the same change on all the computers I look after. It looks like this pretty much:

printf "machine1:\n"
ssh machine1 $1
printf "machine2:\n"
ssh machine2 $1
printf "machine3:\n"
ssh machine3 $1
printf "machine4:\n"
ssh machine4 $1
..

If the operation is complex, it can take some time to go through all the machines serially. I've placed an & after the commands so that the script stops waiting for each command to complete, but now the print statements are all but useless to help me trace errors back to machines. Can someone recommend a way in which I can keep the speed and the meaningful output? Something simpler than sending STDOUT and STDERR to a different file for each machine?

thanks in advance,
Jurvis LaSalle




--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux