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!
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
Le Wednesday 24 January 2007 23:16, Matthew Martz a écrit :
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:
# no need to edit anything below here if [ -f $LOCKFILE ] then echo Lock file exists...Exiting... exit 0
This part is not safe. If computer get down, or script killed, the lock will stay.
To avoid such issue I used in past: ===========
if [ -f ${lock} ]; then [ -d /proc/`cat ${lock}` ] && exit 0 fi
clean () { rm -fr ${lock} }
trap clean 0
echo -n $$ > ${lock}
===========
Now I used more sophisticated tools like mmm (http://mmm.zarb.org/) to massivelly run rsync job.
The code above is of course under GPL or any other license which allow you reuse it and/or improve it ;)