Merges George changes
[p2p-testing-infrastructure.git] / Utils / sync_cluster.sh
1 #!/bin/bash
2 #
3 # Copyright: George Milescu 2010 - george.milescu@gmail.com
4 #
5 # The script can be used with one parameter or with no parameters
6
7 # Read the global configuration file
8 # Check if the global configuration file exists
9 if [ ! -e ../ControlScripts/globalconfig ]; then
10         echo "Warning: The global config file ../ControlScripts/globalconfig does not exist."
11 else
12         source ../ControlScripts/globalconfig
13 fi
14
15 if [ $# -gt 1 ]; then
16         echo "Usage:"
17         echo "* to synchronize one remote system: $0 remote-system"
18         echo "* to synchronize all cluster systems: $0"
19         exit 1
20 fi
21
22 sync_cluster_host() {
23         remote_system=$1
24         echo "Syncing $remote_system"
25         xterm -e "rsync -avP --del $P2P_NEXT_REL_PATH/ p2p@${remote_system}:/home/ve/george/P2P-Next/" &
26 }
27
28 if [ $# -eq 0 ]; then
29         for host in p2p-next-01.grid.pub.ro p2p-next-02.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
30                 sync_cluster_host $host
31         done
32 else
33         sync_cluster_host $1
34 fi
35
36