[mirror-admin] Only run rsync if something has actually changed
Adrian Reber
adrian at lisas.de
Tue Sep 30 06:50:09 EDT 2014
I am using dl.fedoraproject.org::fedora-buffet0/ to mirror Fedora and
a rsync run which downloads no new files still needs around 2500 seconds
to check if there have been any changes.
To avoid running rsync without actually downloading anything I have
written a script which queries Fedora's message bus to see if there
have been changes or not.
The script is available at:
https://fedorahosted.org/fedora-infrastructure/attachment/ticket/4539/last-sync
and details about its usage are right now only documented in this ticket:
https://fedorahosted.org/fedora-infrastructure/ticket/4539
As I am recording for each mirror the starttime, endtime and status I
can avoid running rsync if nothing has actually changed. I have added
the following lines to my mirror script:
# check if mirror needs to be updated
CURDATE=`date +%s`
LASTRUN=$( # some sql command to query the last successful run )
DELTA=`echo ${CURDATE}-${LASTRUN} | bc`
/path/to/last-sync -d ${DELTA} -q
if [ "$?" -ne "0" ]; then
# no changes on the master mirror
# abort
exit 0
fi
As this might be helpful for other mirrors I am posting it here.
Adrian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: not available
URL: <http://mail.ale.org/pipermail/mirror-admin/attachments/20140930/aaa023e4/attachment.sig>
-------------- next part --------------
--
More information about the Mirror-admin
mailing list