From ef7e4a38071bd2d51a6adebc553804cd6c3d38b0 Mon Sep 17 00:00:00 2001 From: George Milescu Date: Thu, 26 Aug 2010 13:34:25 +0200 Subject: [PATCH] Updated sync scripts to simplify usage. Added scripts for das2 Signed-off-by: George Milescu --- Utils/cssh_das2.sh | 20 +++++++++++++++ Utils/sync_cluster.sh | 27 +++++++++++++++++--- Utils/sync_cluster_containers.sh | 27 +++++++++++++++++--- Utils/sync_das2.sh | 34 ++++++++++++++++++++++++++ Utils/sync_single_cluster.sh | 22 ----------------- Utils/sync_single_cluster_container.sh | 23 ----------------- 6 files changed, 101 insertions(+), 52 deletions(-) create mode 100755 Utils/cssh_das2.sh create mode 100755 Utils/sync_das2.sh delete mode 100755 Utils/sync_single_cluster.sh delete mode 100755 Utils/sync_single_cluster_container.sh diff --git a/Utils/cssh_das2.sh b/Utils/cssh_das2.sh new file mode 100755 index 0000000..d521a65 --- /dev/null +++ b/Utils/cssh_das2.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +# Copyright: George Milescu 2010 - george.milescu@gmail.com +# +# Bash script used to connect to the machines on DAS-2 +# The script +# * starts a cssh session +# * sets the size of the windows to 78x19 +# +# Script arguments: +# * remote user + +if [ ! $# -eq 1 ]; then + echo "usage: $0 user" + exit 1 +fi + +REMOTE_USER=$1 + +cssh --term-args "-geometry 78x19" $REMOTE_USER@node300 $REMOTE_USER@node301 $REMOTE_USER@node302 $REMOTE_USER@node303 $REMOTE_USER@node304 $REMOTE_USER@node306 $REMOTE_USER@node308 $REMOTE_USER@node309 $REMOTE_USER@node311 $REMOTE_USER@node312 $REMOTE_USER@node313 $REMOTE_USER@node314 $REMOTE_USER@node315 diff --git a/Utils/sync_cluster.sh b/Utils/sync_cluster.sh index 1ac756d..143f754 100755 --- a/Utils/sync_cluster.sh +++ b/Utils/sync_cluster.sh @@ -2,6 +2,7 @@ # # Copyright: George Milescu 2010 - george.milescu@gmail.com # +# The script can be used with one parameter or with no parameters # Read the global configuration file # Check if the global configuration file exists @@ -11,6 +12,26 @@ else source ../ControlScripts/globalconfig fi -for host in p2p-next-01.grid.pub.ro p2p-next-03.grid.pub.ro p2p-next-04.grid.pub.ro p2p-next-05.grid.pub.ro p2p-next-06.grid.pub.ro p2p-next-07.grid.pub.ro p2p-next-08.grid.pub.ro p2p-next-09.grid.pub.ro p2p-next-10.grid.pub.ro; do - ./sync_single_cluster.sh $host -done +if [ $# -gt 1 ]; then + echo "Usage:" + echo "* to synchronize one remote system: $0 remote-system" + echo "* to synchronize all cluster systems: $0" + exit 1 +fi + +sync_cluster_host() { + remote_system=$1 + echo "Syncing $remote_system" + rsync -avP --del $P2P_NEXT_REL_PATH/P2P-Testing-Infrastructure p2p@${remote_system}:/home/p2p/george/P2P-Next/ +} + +if [ $# -eq 0 ]; then + for host in p2p-next-01.grid.pub.ro p2p-next-03.grid.pub.ro p2p-next-04.grid.pub.ro p2p-next-05.grid.pub.ro p2p-next-06.grid.pub.ro p2p-next-07.grid.pub.ro p2p-next-08.grid.pub.ro p2p-next-09.grid.pub.ro p2p-next-10.grid.pub.ro; do + sync_cluster_host $host + done +else + sync_cluster_host $1 +fi + + + diff --git a/Utils/sync_cluster_containers.sh b/Utils/sync_cluster_containers.sh index 981fc6f..249c3b7 100755 --- a/Utils/sync_cluster_containers.sh +++ b/Utils/sync_cluster_containers.sh @@ -2,6 +2,7 @@ # # Copyright: George Milescu 2010 - george.milescu@gmail.com # +# The script can be used with two parameters or with no parameters # Read the global configuration file # Check if the global configuration file exists @@ -11,8 +12,26 @@ else source ../ControlScripts/globalconfig fi -for host in p2p-next-01.grid.pub.ro p2p-next-03.grid.pub.ro p2p-next-04.grid.pub.ro p2p-next-05.grid.pub.ro p2p-next-06.grid.pub.ro p2p-next-07.grid.pub.ro p2p-next-08.grid.pub.ro p2p-next-09.grid.pub.ro p2p-next-10.grid.pub.ro; do - for port in 10122 10222 10322 10422 10522 10622 10722 10822 10922 11022; do - ./sync_single_cluster_container.sh $host $port +sync_cluster_container() { + host=$1 + port=$2 + echo "Syncing $host $port" + rsync -avP --del --rsh='ssh -p'$port $P2P_NEXT_REL_PATH/P2P-Testing-Infrastructure p2p@$host:/home/p2p/george/ > /dev/null +} + +if [ $# -gt 1 ]; then + echo "Usage:" + echo "* to synchronize one remote system: $0 remote-system remote-port" + echo "* to synchronize all cluster containers: $0" + exit 1 +fi + +if [ $# -eq 0 ]; then + for host in p2p-next-01.grid.pub.ro p2p-next-03.grid.pub.ro p2p-next-04.grid.pub.ro p2p-next-05.grid.pub.ro p2p-next-06.grid.pub.ro p2p-next-07.grid.pub.ro p2p-next-08.grid.pub.ro p2p-next-09.grid.pub.ro p2p-next-10.grid.pub.ro; do + for port in 10122 10222 10322 10422 10522 10622 10722 10822 10922 11022; do + sync_cluster_container $host $port + done done -done +else + sync_cluster_container $host $port +fi \ No newline at end of file diff --git a/Utils/sync_das2.sh b/Utils/sync_das2.sh new file mode 100755 index 0000000..a873527 --- /dev/null +++ b/Utils/sync_das2.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# Copyright: George Milescu 2010 - george.milescu@gmail.com +# +# The script can be used with one parameter or with no parameters + +# Read the global configuration file +# Check if the global configuration file exists +if [ ! -e ../ControlScripts/globalconfig ]; then + echo "Warning: The global config file ../ControlScripts/globalconfig does not exist." +else + source ../ControlScripts/globalconfig +fi + +sync_das2_host() { + remote_system=$1 + echo "Syncing $remote_system" + rsync -avP --del $P2P_NEXT_REL_PATH gmilescu@${remote_system}:/home/gmilescu/P2P-Next +} + +if [ $# -gt 1 ]; then + echo "Usage:" + echo "* to synchronize one remote system: $0 remote-system" + echo "* to synchronize all cluster systems: $0" + exit 1 +fi + +if [ $# -eq 0 ]; then + for host in node300 node301 node302 node303 node304 node306 node308 node309 node311 node312 node313 node314 node315; do + sync_das2_host $host + done +else + sync_das2_host $1 +fi \ No newline at end of file diff --git a/Utils/sync_single_cluster.sh b/Utils/sync_single_cluster.sh deleted file mode 100755 index 77c7944..0000000 --- a/Utils/sync_single_cluster.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# Copyright: George Milescu 2010 - george.milescu@gmail.com -# -# 2010, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro - -if test $# -ne 1; then - echo "Usage: $0 remote-system" 1>&2 - exit 1 -fi - -# Read the global configuration file -# Check if the global configuration file exists -if [ ! -e ../ControlScripts/globalconfig ]; then - echo "Warning: The global config file ../ControlScripts/globalconfig does not exist." -else - source ../ControlScripts/globalconfig -fi - -remote_system=$1 - -rsync -avP --del $P2P_NEXT_REL_PATH/P2P-Testing-Infrastructure p2p@${remote_system}:/home/p2p/george/P2P-Next/ diff --git a/Utils/sync_single_cluster_container.sh b/Utils/sync_single_cluster_container.sh deleted file mode 100755 index 4d5f68f..0000000 --- a/Utils/sync_single_cluster_container.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# -# Copyright: George Milescu 2010 - george.milescu@gmail.com -# - -if test $# -ne 2; then - echo "Usage: $0 host port" 1>&2 - exit 1 -fi - -# Read the global configuration file -# Check if the global configuration file exists -if [ ! -e ../ControlScripts/globalconfig ]; then - echo "Warning: The global config file ../ControlScripts/globalconfig does not exist." -else - source ../ControlScripts/globalconfig -fi - -host=$1 -port=$2 - -echo "Syncing $host $port" -rsync -avP --del --rsh='ssh -p'$port $P2P_NEXT_REL_PATH/P2P-Testing-Infrastructure p2p@$host:/home/p2p/george/ > /dev/null -- 2.20.1