Difference between revisions of "Mirror rsync setup"

From CSLabsWiki
(add tags)
(remove code tag)
Line 3: Line 3:
   
 
Template: /etc/mirrorscripts/generic.sh
 
Template: /etc/mirrorscripts/generic.sh
<pre><code>
+
<pre>
 
#!/bin/bash
 
#!/bin/bash
   
Line 32: Line 32:
 
exit 1
 
exit 1
 
fi
 
fi
</code></pre>
+
</pre>

Revision as of 15: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

#!/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