#!/bin/sh # sends a command to every host in parallel and collects its output # in individual files per host which can be grepped and post-processed. # The files are contained within a directory named by the process number. echo Job id: $$ mkdir $$ date > $$/Command echo $@ >> $$/Command #for i in `cat hosts-swap` for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 # 37 38 39 do (ssh gaia$i "$@" >> $$/node-`printf %02d $i` 2>&1) & # Use the following variant, if you prefer the output files to be named # exactly as the hostname. # (ssh $i "$@" >> $$/$i 2>&1) & done