#! /bin/sh # # Rsync script # Copyright 1999-2003 DVL Software Limited # # Available from http://www.freebsddiary.org/samples/rsync.txt if ! export PREFIX=$(expr $0 : "\(/.*\)/etc/rsync/update\.sh\$"); then echo "$0: Cannot determine the PREFIX" >&2 exit 1 fi export PATH=/bin:/usr/bin:${PREFIX}/bin lock=/var/spool/lock/rsync.lock log=/var/log/rsync.log # Rotate the log files umask 22 test -f ${log}.7 && mv -f ${log}.7 ${log}.8 test -f ${log}.6 && mv -f ${log}.6 ${log}.7 test -f ${log}.5 && mv -f ${log}.5 ${log}.6 test -f ${log}.4 && mv -f ${log}.4 ${log}.5 test -f ${log}.3 && mv -f ${log}.3 ${log}.4 test -f ${log}.2 && mv -f ${log}.2 ${log}.3 test -f ${log}.1 && mv -f ${log}.1 ${log}.2 test -f ${log}.0 && mv -f ${log}.0 ${log}.1 test -f ${log} && mv -f ${log} ${log}.0 exec >${log} 2>&1 # Do the update date "+rsync update begins at %Y/%m/%d %H:%M:%S" # The rest of this is executed while holding the lock file, to ensure that # multiple instances won't collide with one another. lockf -t 0 ${lock} /bin/sh << 'E*O*F' base=${PREFIX}/etc/rsync cd ${base} || exit . ./config.sh || exit colldir=sup.client startup=${PREFIX}/etc/rc.d umask 2 echo "" echo "Updating from ${host} - 3.0-RELEASE" rsync -av --stats ${host}::freebsd/releases/3.0-RELEASE /pub/ftp/pub/FreeBSD/releases/ echo "========================================" echo "" echo "Updating from ${host} - 2.2.8-RELEASE" rsync -av --stats ${host}::freebsd/releases/2.2.8-RELEASE /pub/ftp/pub/FreeBSD/releases/ echo "========================================" echo "" echo "Updating from ${host} - XFree86" rsync -av --stats ${host}::freebsd/releases/XFree86 /pub/ftp/pub/FreeBSD/releases/ echo "========================================" echo "" echo "Updating from ${host} - tools " rsync -av --stats ${host}::freebsd/tools /pub/ftp/pub/FreeBSD/tools echo "========================================" echo "" echo "Updating from ${host} - CERT" rsync -av --stats ${host}::freebsd/CERT /pub/ftp/pub/FreeBSD/ E*O*F date "+rsync update ends at %Y/%m/%d %H:%M:%S"