title: rsync between a master and slave server to a remote repository storage
body: <p>I am putting together an backup/archive mechanism using RSYNC. 
  my situation is that I have 2 servers, 1 is primary production, 2 is passive failover.  I have rsync archiving running on a single system, the primary, it is working as expected. I also, have the same scripts/cron/, system on the failover server.  however, at this time, I have the cron on failover commented out so it doesn't execute.  I would like to not have to deal with switching over as a manual operation.<br>
  both servers rsync the exact same locations just on different servers.</p>
  
  <p>I am worried that if I let the failover rsync run as scheduled on the failover box, that it will somehow destroy or corrupt the archives.  I'm not sure my concern is justified. because, thinking, if the failover cron kicks off, runs the rsync archive scripts, and there are no files to be archived, nothing will happen, however, if failover servers has files to sync, these files will simply be written to the archive by rsync and builds on the incremental backup. so essentually it is safe.  I'm just not sure.  Should I create an env variable, to control the rsync archives or am I over thinking this?</p>
  
  <p>Rsync is working as expected on each server separately. just don't know how it is to be implemented in this use case. </p>
  
  <p>hourly and daily are taken, example hourly below:</p>
  
  <pre><code>set -x
  
  SNAPSHOT=/SystemArchiveEndpoint/PassThru
  EXCLUDES=/data1/backup/scripts/data/passthru_backup_exclude.txt
  
  if [ -d $SNAPSHOT/processed-hourly.3 ]
  then
  rm -rf $SNAPSHOT/processed-hourly.3
  fi
  
  if [ -d $SNAPSHOT/processed-hourly.2 ]
  then
  mv $SNAPSHOT/processed-hourly.2 $SNAPSHOT_RW/processed-hourly.3
  fi
  
  if [ -d $SNAPSHOT/processed-hourly.1 ]
  then
  mv $SNAPSHOT/processed-hourly.1 $SNAPSHOT_RW/processed-hourly.2
  fi
  
  if [ -d $SNAPSHOT/processed-hourly.0 ]
  then
  cp -al $SNAPSHOT/processed-hourly.0 $SNAPSHOT_RW/processed-hourly.1
  fi
  
  rsync -va /app/PassThruMultiTenantMT1/latest/digital/ /SystemArchiveEndpoint/PassThru/processed-hourly.0
  
  touch $SNAPSHOT/processed-hourly.0
  
  exit 0
  </code></pre>