[CentOS-mirror] new centos mirror in israel

Matthew Martz mdmartz at gflug.net
Tue Nov 14 13:25:48 UTC 2006


> Anyone know how to do those "locks" that they mention for the cron job?

Sample simple rsync shell script with lock files:

#!/bin/bash

RSYNC="/usr/bin/rsync" # path to rsync
FLAGS="-aqzH --delete" # flags to pass to rsync
MIRROR="msync.centos.org::CentOS" # mirror url
REPO="/var/ftp/pub/centos" # location to store files
LOCKFILE="/var/lock/subsys/rsynccentos" # location of lock file

if [ -f $LOCKFILE ] # check to see if lock file exists
then
        echo Lock file exists...Exiting...
        exit 0
else
        touch $LOCKFILE # create lock file
fi
echo Rsyncing...
$RSYNC $FLAGS $MIRROR $REPO # issue rsync command
rm -f $LOCKFILE # remove lockfile
exit 0

-- 
Matthew Martz
CentOS Mirror Admin
mdmartz at gflug.net




More information about the CentOS-mirror mailing list