Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#9669 - [Mirrors] rsync status file for mirror checking

Attached to Project: Arch Linux
Opened by Gerhard Brauer (GerBra) - Sunday, 24 February 2008, 17:28 GMT
Last edited by eliott (cactus) - Saturday, 12 April 2008, 22:00 GMT
Task Type Feature Request
Category System
Status Closed
Assigned To Dale Blount (dale)
Jason Chu (jason)
Jan de Groot (JGC)
Aaron Griffin (phrakture)
eliott (cactus)
Architecture All
Severity Low
Priority Normal
Reported Version 2007.08-2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Hi, first excuse my bad english, i hope you see what i mean ;-)

I (maybe someone still knows) do a little mirror checking since a few weeks.
I do this by a script which try to check since when a mirror wasn't syned.
The problem is: the only time checking i could do is calculating the difference of the mtime from each of the repo/architecture db file.
But this says nothing about the last mirror sync run (ex. you Devs update core and
so i only have a time diff between now and mtime of the core db on the mirror.
If this diff is for ex. 5 days i could not assume that the mirror has not synced since 5 days)

I thought about a solution, maybe found one which could be easily implemented
with no harm:
Could you run a cron script on rsync.archlinux.org which touch short after midnight some files? I guess:
The files could be 0 byte files named lastsync.
One should be placed in the main dir of the rsync module ::ftp and one in each repository for both architectures.

So i (and maybe others) could easily check when the mirror overall last synced and also for each repo.

This task depends upon

Closed by  eliott (cactus)
Saturday, 12 April 2008, 22:00 GMT
Reason for closing:  Implemented
Additional comments about closing:  implemented.
Comment by Pierre Schmitz (Pierre) - Sunday, 24 February 2008, 18:37 GMT
OK, just for testing, I have added a cron which does the following:

date > /home/ftp/{core,extra,testing,unstable}/os/{i686,x86_64}/.lastsync

This way we should be able to check how often a mirror syncs.
Comment by Gerhard Brauer (GerBra) - Monday, 25 February 2008, 14:42 GMT
Thanks, it works.
Date is in UTC (date -u)
At the moment i used these values only for display until most/all mirrors have synced with.
We have no .lastsync currently in [community] cause Pierrehas no access(?). If we want this too maybe Pierre's cron job must be run by a user with higher privileges.

It's not only usefull for my script, one could easily do for ex. a:
-----
wget -q -O - ftp://ftp.archlinux.org/core/os/i686/.lastsync
Mon Feb 25 14:01:01 UTC 2008
----
to get the last sync for a mirror and repo. Also we could see: the mirror must have done his sync between time reported and a 2 hour offset, where all times must be interpreted in UTC.

Comment by Gerhard Brauer (GerBra) - Monday, 25 February 2008, 14:46 GMT
To explain: 2 hour offset
Pierres cron job is run every 2 hours (Pierre, correct me if i'm wrong)
Comment by Gerhard Brauer (GerBra) - Thursday, 13 March 2008, 05:45 GMT
After some time watching and using this feature i guess some changes:

* Rename the sync file from .lastsync to lastsync. Some ftp servers doesn't allow access to hidden files.
* Add the [community] repo also to the cron job.

Comment by Pierre Schmitz (Pierre) - Friday, 11 April 2008, 10:56 GMT
OK, we nned someone with root-access to do this. A cron-job like this is needed (attention: this only works with zsh):

LANG=C date -u > /home/ftp/{core,extra,testing,unstable,community}/os/{i686,x86_64}/lastsync

Using bahs the following should work:

LANG=C date | tee /home/ftp/{core,extra,testing,unstable,community}/os/{i686,x86_64}/lastsync >/dev/null
Comment by Pierre Schmitz (Pierre) - Friday, 11 April 2008, 12:27 GMT
The result of all this can be seen at http://users.archlinux.de/~gerbra/mirrorcheck.html
Comment by Aaron Griffin (phrakture) - Friday, 11 April 2008, 19:35 GMT
Is this taken care of already?
Comment by eliott (cactus) - Saturday, 12 April 2008, 21:42 GMT
A much better date syntax would be `date +"%s"`
seconds since the epoch is much easier to parse, and perform simple math upon via the shell or other language. It is also not sensitive to timezone (as clients do the differential calculations to arrive at localtime).

date +"%s" > /home/ftp/{core,extra,testing,unstable,community}/os/{i686,x86_64}/lastsync

Comment by eliott (cactus) - Saturday, 12 April 2008, 21:58 GMT
implemented.

/etc/cron.hourly/lastsync.sh

##########
#!/bin/bash

REPOS=('core' 'extra' 'community')
ARCHES=('i686' 'x86_64')

for repo in ${REPOS[@]}; do
for arch in ${ARCHES[@]}; do
date +"%s" > "/home/ftp/${repo}/os/${arch}/lastsync"
done
done
##########

edit:
oh. also.. you can easily convert back to localtime from within bash (most shells).
>>> date -d "@$(wget -q -O - ftp://ftp.archlinux.org/core/os/i686/lastsync)";
>> Sat Apr 12 18:01:05 EDT 2008

Loading...