[CentOS-mirror] New Mirror Setup Questions
Maeltor
istolil at qopinc.org
Tue Mar 4 21:55:20 UTC 2008
Forgive me for being somewhat green here
I have a few more questions. Does this script look reasonable? Is
there anything I need to adjust to use the lock files you posted?
I want to restrict my mirror to Ver 5 to save on space and bandwidth
(and since realistically it probably won't be used by many people
other than me).
Please have a look at this script:
#!/bin/sh
# please adjust
lock=~/`basename ${0}`.lock
if [ -f ${lock} ]; then
# This ensure script didn't die w/o removing lock
# Ex: power failure
[ -d /proc/`cat ${lock}` ] && exit 0
fi
clean () {
rm -fr ${lock}
}
trap clean 0
rsync="/usr/bin/rsync -aqHz --delete --delay-updates"
# this should be auto-selected, but the centos mirror script doesn't
# support selection by a specific protocol (i.e., rsync)
#mirror=mirror.stanford.edu::mirrors/centos
#mirror=centos.cs.wisc.edu::centos
#mirror=mirrors.usc.edu::centos
mirror=us-msync.centos.org::CentOS
ver=5
archlist="i386 x86_64"
baselist="os updates"
local=/var/www/centos
for arch in $archlist
do
for base in $baselist
do
remote=$mirror/$ver/$base/$arch/
$rsync $remote $local/$ver/$base/$arch/
done
done
On Mar 4, 2008, at 11:57 AM, Olivier Thauvin wrote:
> Le mardi 4 mars 2008, Maeltor a écrit :
>
>> My questions are:
>> If I am to sync 2-4 times a day, how do I setup lock files in a
>> script?
>> Right now i'm just using a single command (listed above). I assume
>> you will most likely tell me to connect to a Tier 1 server to sync
>> from instead of a master server right?
>
> Here an extract of one of my own script:
>
> ########################
> #!/bin/bash
>
> # please adjust
> lock=~/`basename ${0}`.lock
>
> if [ -f ${lock} ]; then
> # This ensure script didn't die w/o removing lock
> # Ex: power failure
> [ -d /proc/`cat ${lock}` ] && exit 0
> fi
>
> clean () {
> rm -fr ${lock}
> }
>
> trap clean 0
>
> rsync ....
>
> clean
>
> ########################
>
> Otherwise, to manage all rsync I am writing an application:
> http://mmm.zarb.org, but I still have finish it (especially doc)...
> The result can be seen here:
> http://distrib-coffee.ipsl.jussieu.fr/mmm
>
> Regards.
More information about the CentOS-mirror
mailing list