chiark / gitweb /
de3142413f7486e91ad9b7ff5051808898b5d4f0
[distorted-bits] / do-slaves
1 #! /bin/sh
2 set -e
3
4 ## Parse the command line.
5 case "$#" in
6   0 | 1)
7     echo >&2 "Usage: $0 COMMAND SLAVE|:SET ..."
8     exit 1
9     ;;
10 esac
11 command=$1; shift
12
13 ## Expand slaves into a big list.
14 slaves=$(expand-list /etc/slaves "$@")
15
16 ## Now do the stuff.
17 for i in $slaves; do
18   { { { echo "starting..."
19         set +e; ssh "$i" "$command" 3>&-; rc=$?; set -e
20         echo "done (rc = $rc)"; } >&3; } 2>&1 | sed 's/^/!!! /'; } 3>&1 |
21   sed "s\a^\a$i: \a" &
22 done
23 wait