Hi all,
I am trying to setup a automated rsync script to synchronize all my files between my machines but I have no clue how I would go on with creating an array for the directories I want to synchronize. What I want to accomplish is to sync all the directories in the $DIRS array to machines in the $SERVERS array. This is what I got so far:
Any help is much appreciated.Code:#!/bin/bash SSHUSER="someuser" PROGRAM="rsync" OPTIONS="-razh --size-only" SERVERS=( machine1.domain.com machine2.domain.com machine3.domain.com ) DIRS=( /home/folder1/ /home/folder2/ ) for server in ${SERVERS[*]} ; do echo "Synchronizing to $server beginning at" `date` $PROGRAM $OPTIONS $DIRS $SSHUSER@$server:/home/$SSHUSER/ echo "Synchronization to $server completed at" `date` done

Reply With Quote
