Re: "parallelizing" a script

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

 



On Tue, Nov 25, 2003 at 04:11:15PM -0500, 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
> <<etc.>>

> 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?

Dunno 'bout simpler, but how about making a named pipe (mknod -p), spawn
a process to read the pipe, then run each of the above as a process
writing to the named pipe?  A meaningless demo:
==START SCRIPT
    mknod foobar p
    (exec 0<foobar;
    while read INLINE
    do
	echo "READER: $INLINE" >>OutFile;
    done;
    exit 0;)&

    (sleep 2;echo "Proc 1"; echo "Output 1";exit 0) 2>&1 >foobar&
    (sleep 1;echo "Proc 2"; echo "Output 2";exit 0) 2>&1 >foobar&
    (sleep 9;echo "Proc 3"; echo "Output 3";exit 0) 2>&1 >foobar&
    (sleep 4;echo "Proc 4"; echo "Output 4";exit 0) 2>&1 >foobar&

    rm foobar;
==END SCRIPT
-- 
	Dave Ihnat
	ignatz@xxxxxxxxxx


-- 
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