#! /usr/local/bin/perl # default number of processes is 8, # but is resettable using the -m argument # # usage: # muxssh [-m max] [-v] [-l username] command [args ...] ) { chomp $machine; print "forking for $machine with ",&alive," alive\n" if ( $verbose ); &wait() if &alive >= $maxpids; $pid = fork; die "fork: $!" unless defined $pid; if ($pid) { # parent $pids{$pid} = $machine; } else { $command = "ssh -f -n -q -c blowfish -x -o \'StrictHostKeyChecking=no\'"; $params = "$machine $remoteuser \'@ARGV\' 2>&1"; open(COM,"$command $params|") || die "Can't issue command:$!"; print "$machine: $_" while ( ); close(COM); exit 0; } } &wait() while &alive > 0;