scripts

misc scripts and tools
git clone git://git.2f30.org/scripts
Log | Files | Refs

commit 946f997d30681e136424744d0ecb63f54df0a3c1
parent caea61a72981f6747bf3ba255bfced2b4f29c6d9
Author: sin <sin@2f30.org>
Date:   Tue,  9 Jul 2013 19:06:28 +0100

Add ssh-multi

Diffstat:
Assh-multi | 27+++++++++++++++++++++++++++
1 file changed, 27 insertions(+), 0 deletions(-)

diff --git a/ssh-multi b/ssh-multi @@ -0,0 +1,27 @@ +#!/bin/sh + +if [ $# -lt 1 ]; then + echo "usage: $(basename $0) <host...>" 2>&1 + exit 1 +fi + +trap 'rm -f ${batch}; exit 1' 2 +batch=$(mktemp) + +echo "#!/bin/sh" >> ${batch} + +while read cmd; do + echo ${cmd} >> ${batch} +done + +echo "echo Press any key to terminate console..." >> ${batch} +echo "read -n 1" >> ${batch} +chmod +x ${batch} + +while [ $# -gt 0 ]; do + scp ${batch} $1:/tmp + urxvt -e sh -c "ssh $1 '${batch}'" + shift +done + +rm ${batch}