[CentOS-mirror] Syncing of CentOS 5 to mirrors.

Fri Apr 13 05:04:56 UTC 2007
Prof. P. Sriram <sriram at ae.iitm.ac.in>

On Fri, 13 Apr 2007, Ross Hosman wrote:
> Does anyone see anything wrong with this crontab 
> 
> * */6 * * * rsync -avz [blah blah blah]

well, nothing seriously wrong, except you keep launching every four hours, 
no matter what. so, if a sync does not complete in four hours, you will 
see multiple instances. i would suspect that the entire 5 tree is not 
syncing up in 4 hours, so you see multiple instances. i will offer a 
couple of suggestions.

ditch the z option; most content is already compressed, why try another z 
on top of it? only end up causing needless cpu load.

write a small script and call the script from crontab; the script could
have a couple of lines to do locking so multiple instances will not occur
- it would look like so (shameless lifted from debian)

HOSTNAME=`hostname -f`
LOCK="somewhere/Archive-Update-in-Progress-${HOSTNAME}"
# Check to see if another sync is in progress
if lockfile -! -l 43200 -r 0 "$LOCK"; then
  echo ${HOSTNAME} is unable to start rsync, lock file exists
  exit 1
fi

-- 
sriram