[CentOS-mirror] About Cron script with lock file

Wed Jan 24 22:16:51 UTC 2007
Matthew Martz <mdmartz at gflug.net>

On Wed, January 24, 2007 2:44 am, Kelphon wrote:
> Dear David,
>
>          Does your cron script for centos mirror work now?
>
>          Could you please send your cron script with lockfile to us ;)
>
> Thanks a lot!

Simple mirror script:

#!/bin/bash

# declare variables here
RSYNC="/usr/bin/rsync"			# file location of rsync
FLAGS="-aqzH --delete"			# rsync flags
MIRROR="msync.centos.org::CentOS"	# rsync mirror
REPO="/var/ftp/pub"			# directory to store files
LOCKFILE="/var/lock/rsync/centos"	# file location fo lock file

# no need to edit anything below here
if [ -f $LOCKFILE ]
then
        echo Lock file exists...Exiting...
        exit 0
else
        touch $LOCKFILE
fi
echo Rsyncing...
$RSYNC $FLAGS $MIRROR $REPO
rm -f $LOCKFILE
exit 0


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