32 lines
928 B
Bash
32 lines
928 B
Bash
|
#!/bin/sh
|
||
|
#
|
||
|
# cluster-deploy.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.
|
||
|
#
|
||
|
# Deploy files on a number of remote hosts using Parallel SCP.
|
||
|
|
||
|
if [ $# -lt 2 ] ; then
|
||
|
echo "Usage: $0 <hosts_list> <file1> [file2 [...]]"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
PSCP=$(command -v parallel-scp || command -v pscp.pssh || command -v pscp)
|
||
|
if [ "$PSCP" = "" ] ; then
|
||
|
echo "Parallel SSH (pssh) is required for this script to work."
|
||
|
exit 2
|
||
|
fi
|
||
|
|
||
|
HOSTS="$HOME/.config/cluster/$1.lst"
|
||
|
shift
|
||
|
echo "Using file '$HOSTS' as hosts' list."
|
||
|
|
||
|
for FILE in $@ ; do
|
||
|
echo "Deploying '$FILE'..."
|
||
|
$PSCP -r -l root -h "$HOSTS" -- "$FILE" /root
|
||
|
done
|