[CentOS-mirror] New Mirror in Myanmar

Tue Aug 1 05:20:19 UTC 2017
Garri Djavadyan <garryd at comnet.uz>

On Tue, 2017-08-01 at 01:41 +0300, Anssi Johansson wrote:
> If you are still 
> looking for a mirror script, it would be neat if some of our fellow 
> mirror admins could share the scripts they are actually using.

Hello list,

Here is an example used for our mirror:

---------
#!/bin/sh

USER=mirror
PROG=mirror-centos
LOCK_FILE=/tmp/${PROG}.lock
LOG_FILE=/var/log/scripts/$PROG.log
SOURCE="msync.centos.org::CentOS"
TARGET="/path/to/mirror/centos"

clean() {
    rm -f ${LOCK_FILE}
}

if [ -f ${LOCK_FILE} ]; then
    echo "Process ${PROG} is already running! Abort."
    exit 1
else
    trap "clean; exit 2" INT TERM EXIT
    touch ${LOCK_FILE}
    su -l ${USER} -c "rsync -aqzH --partial --delete-delay --delay-
updates \
        --log-file=${LOG_FILE} ${SOURCE} ${TARGET}" || { echo "Sync
failed."; clean; exit 3; }
    clean
fi
---------

HTH,

Garri