#!/bin/bash
# Copy clustered configs from this node to other node
# mReschke 2012-02-22

# Include main cluster.conf
source /etc/nwq/cluster/cluster.conf

rsync="rsync -va --delete"
if [ "$HOSTNAME" == "$host1" ];
then
    echo "Copying configs and scripts from $host1 to $host2"
    ssh="ssh -p $port2"
    dest="root@$host2:"
else
    echo "Copying configs and scripts from $host2 to $host1"
    ssh="ssh -p $port1"
    dest="root@$host1:"
fi
# Copy each config file to other node
for src in "${sync_configs[@]}"
do
    $rsync -e "$ssh" $src ${dest}$src
done
exit 0

