rsync.conf includes folders like this source, dest directories.
/usr/local/test/;/usr/local/test/
rsynchosts.conf put hostnames (a host for every line)
REMOTEUSER=username
CONFFILE=/usr/local/etc/rsync.conf
HOSTFILE=/usr/local/etc/rsynchosts.conf
cat $HOSTFILE | grep -v "#" | while read HOSTFILE
do
REMOTEHOST=`echo $HOSTFILE |awk -F";" '{ print $1 }'`
cat $CONFFILE | grep -v "#" | while read CONF
do
LOCALDIR=`echo $CONF |awk -F";" '{ print $1 }'`
REMOTEDIR=`echo $CONF |awk -F";" '{ print $2 }'`
echo $REMOTEHOST
rsync -avz -e ssh $LOCALDIR $REMOTEUSER@$REMOTEHOST:$REMOTEDIR
done
done
No comments:
Post a Comment