revert to a working version of the sync script for rdu. The other version crashed out too often for some reason.
This commit is contained in:
parent
038ea8098d
commit
c6f0ec6ed5
1 changed files with 16 additions and 45 deletions
|
@ -8,56 +8,27 @@
|
|||
RSYNC='/usr/bin/rsync'
|
||||
RS_OPT="-avSHP --numeric-ids --log-file=/var/log/rsync-update.log"
|
||||
RS_DEADLY="--delete --delete-excluded --delete-delay --delay-updates"
|
||||
ALT_EXCLUDES=""
|
||||
EPL_EXCLUDES=""
|
||||
FED_EXCLUDES=""
|
||||
|
||||
DATE_EPEL='/root/last-epel-sync'
|
||||
DATE_FED='/root/last-fed-sync'
|
||||
DATE_ARCHIVE='/root/last-archive-sync'
|
||||
DATE_ALT='/root/last-alt-sync'
|
||||
DATE_SECOND='/root/last-second-sync'
|
||||
|
||||
for i in ${DATE_EPEL} ${DATE_FED} ${DATE_ARCHIVE} ${DATE_ALT} ${DATE_SECOND}; do
|
||||
touch ${i}
|
||||
done
|
||||
|
||||
LAST_SYNC='/usr/local/bin/last-sync'
|
||||
|
||||
SERVER=download-ib01.fedoraproject.org
|
||||
|
||||
function sync_stuff() {
|
||||
if [[ $# -ne 5 ]]; then
|
||||
echo "Illegal number of arguments to sync_stuff: " $#
|
||||
exit 1
|
||||
fi
|
||||
DATE_FILE=$1
|
||||
LOGGER_NAME=$2
|
||||
RSYNC_FROM=$3
|
||||
RSYNC_TO=$4
|
||||
FLAG="$5"
|
||||
|
||||
CURDATE=$( date +%s )
|
||||
if [[ -s ${DATE_FILE} ]]; then
|
||||
LASTRUN=$( cat ${DATE_FILE} | awk '{print int($NF)}' )
|
||||
else
|
||||
LASTRUN=$( date +%s --date="Jan 1 00:00:00 UTC 2007" )
|
||||
fi
|
||||
DELTA=`echo ${CURDATE}-${LASTRUN} | bc`
|
||||
|
||||
${LAST_SYNC} -d ${DELTA} -q ${FLAG}
|
||||
|
||||
if [ "$?" -eq "0" ]; then
|
||||
${RSYNC} ${RS_OPT} ${RS_DEADLY} ${ALT_EXCLUDES} ${SERVER}::${RSYNC_FROM} ${RSYNC_TO} | tail -n2 | logger -p local0.notice -t ${LOGGER_NAME}
|
||||
echo ${CURDATE} > ${DATE_FILE}
|
||||
else
|
||||
logger -p local0.notice -t ${LOGGER_NAME} "No change found. Not syncing"
|
||||
fi
|
||||
}
|
||||
|
||||
sync_stuff ${DATE_EPEL} rsync_epel fedora-epel0 /srv/pub/epel/ "-e"
|
||||
sync_stuff ${DATE_FED} rsync_fedora fedora-enchilada0 /srv/pub/fedora/ "-f"
|
||||
sync_stuff ${DATE_SECOND} rsync_second fedora-secondary0 /srv/pub/fedora-secondary/ "-f"
|
||||
# http://dl.fedoraproject.org/pub/epel/
|
||||
${RSYNC} ${RS_OPT} ${RS_DEADLY} ${EPL_EXCLUDES} ${SERVER}::fedora-epel/ /srv/pub/epel/ | tail -n2 | logger -p local0.notice -t rsync_updates_epel
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Unable to finish sync to epel"
|
||||
fi
|
||||
|
||||
# http://dl.fedoraproject.org/pub/fedora/
|
||||
${RSYNC} ${RS_OPT} ${RS_DEADLY} ${FED_EXCLUDES} ${SERVER}::fedora-enchilada0/ /srv/pub/fedora/ | tail -n2 | logger -p local0.notice -t rsync_updates_fedora
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Unable to finish sync to fedora"
|
||||
fi
|
||||
# http://dl.fedoraproject.org/pub/fedora-secondary/
|
||||
${RSYNC} ${RS_OPT} ${RS_DEADLY} ${FED_EXCLUDES} ${SERVER}::fedora-secondary0/ /srv/pub/fedora-secondary/ | tail -n2 | logger -p local0.notice -t rsync_updates_fedora_2nd
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Unable to finish sync to fedora-secondary"
|
||||
fi
|
||||
|
||||
# CentOS
|
||||
${RSYNC} ${RS_OPT} ${RS_DEADLY} master-1.centos.org::CentOS-community-cage/centos/ /srv/pub/centos/ | tail -n2 | logger -p local0.notice -t rsync_centos
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue