mkaptsrc: Been in service for a while, but now worth distributing.
[distorted-bits] / do-slaves
CommitLineData
f1b539a1
MW
1#! /bin/sh
2set -e
3
4## Parse the command line.
5case "$#" in
6 0 | 1)
7 echo >&2 "Usage: $0 COMMAND SLAVE|:SET ..."
8 exit 1
9 ;;
10esac
11command=$1; shift
12
13## Expand slaves into a big list.
14slaves=$(expand-list /etc/slaves "$@")
15
16## Now do the stuff.
17for i in $slaves; do
18 { { { echo "starting..."
19 set +e; ssh "$i" "$command" 3>&-; rc=$?; set -e
b3972a88
MW
20 echo "done (rc = $rc)"; } >&3; } 2>&1 |
21 while IFS= read line; do echo "!!! $line"; done; } 3>&1 |
22 while IFS= read line; do echo "$i: $line"; done &
f1b539a1
MW
23done
24wait