I like to use a lock file. This way the script will loop till lock file is gone than re execute:
Code:
#
# create name for lock file
#
lockDir="/root/lock_files"
lockFilePath="$lockDir/file.lock"
#
#
#
# Loop through servers until file is no longer exists
#
while [ -e "$lockFilePath" ]
do
exit
done
#
#
#
# create new lock file
#
touch $lockFilePath
#
#
#
# loop through servers and sync docroots and code
#
/usr/bin/rsync --stats -e ssh -rlvtgoDz --delete /dir/dir/dir/ root@server:/dir/dir/dir/ &
#
#
#
# Remove lock file........
#
rm -f $lockFilePath
Be sure to set up ssh keys. This is run on a Red Hat system.
Good Luck