Difference between revisions of "Mirror rsync setup"

From CSLabsWiki
(Stuff)
 
(add tags)
Line 3: Line 3:
   
 
Template: /etc/mirrorscripts/generic.sh
 
Template: /etc/mirrorscripts/generic.sh
  +
<pre><code>
 
#!/bin/bash
 
#!/bin/bash
   

Revision as of 14:37, 19 April 2014

All of the scripts that rsync content from other mirrors to our mirror live in /etc/mirrorscripts. The user mirrroradmin owns and runs all of the scripts here. It also owns /storage. Mirroradmin runs the scripts through cron. The log files end up in /var/log/rsync/ and the lock files in /var/lock/rsync.

Template: /etc/mirrorscripts/generic.sh

<code>
#!/bin/bash

data=
data_location=
mirror=

source /etc/mirrorscripts/globalvars

if [ ! -e ${lockfile} ]
then
  ${TOUCH} ${lockfile}

  if [ ! -d ${data_location} ]; then
    ${MKDIR} ${data_location}
  fi

  echo "Sync started on $(${DATE})." >> ${logfile}

  ${RSYNC} ${options} ${mirror}::${data} ${data_location} >> ${logfile}

  ${RM} ${lockfile}

  exit 0
else
  echo "Sync already running on $(${DATE})." >> ${errorlogfile}
  
  exit 1
fi
</code>