scripts/cluster/cluster-ssh.sh

26 lines
725 B
Bash
Executable File

#!/bin/sh
#
# cluster-ssh.sh, Copyright © 2013 Matteo Cypriani <mcy@lm7.fr>
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
#
# Open an SSH interactive shell on a list of remote hosts, opening one
# GNU Screen tab per host.
if [ $# -ne 1 ] ; then
echo "Usage: $0 <hosts_list>"
exit 1
fi
HOSTS="$HOME/.config/cluster/$1.lst"
shift
echo "Using file '$HOSTS' as hosts' list."
for HOST in $(cat "$HOSTS") ; do
screen -t $HOST ssh root@$HOST
done