[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Obsessed with a clean system



On Thu, 2004-08-12 at 13:36, Lourens Steenkamp wrote:
> Lourens replying to Greg Folkert <greg@gregfolkert.net> wrote:
> 
> [big snip]
> 
> >  
> >  Doesn't matter to me... I have a local mirror for the 4 archs I use.
> 
> I have also aquired a mirror (woody, sarge, sid, experimental, security
> stuff, no src).
> Could you tell me how you keep your mirror in sync?
> 
> TIA.

I apologize for the over-length lines. I don't like to break-up these
kinds of lines.

I use this script:

#------------Begin Script

        #! /bin/sh
        set -e
        
        # This script originates from http://www.debian.org/mirror/anonftpsync
        
        # Note: You MUST have rsync 2.0.16-1 or newer, which is available in slink
        # and all newer Debian releases, or at http://rsync.samba.org/
        
        # Set the variables below to fit your site. You can then use cron to have
        # this script run daily to automatically update your copy of the archive.
        
        # Don't forget:
        # chmod 744 anonftpsync
        
        # TO is the destination for the base of the Debian mirror directory
        # (the dir that holds dists/ and ls-lR).
        
        TO=/publish/debian
        
        OPTIONS="--verbose --recursive --links --hard-links --times --compress --delete --delete-after"
        
        # RSYNC_HOST is the site you have chosen from the mirrors file.
        # (http://www.debian.org/mirror/list-full)
        
        RSYNC_HOST=ftp.us.debian.org
        
        # RSYNC_DIR is the directory given in the "Packages over rsync:" line of
        # the mirrors file for the site you have chosen to mirror.
        
        RSYNC_DIR=debian/
        
        # EXCLUDE is a list of parameters listing patterns that rsync will exclude.
        # The following example would exclude mostly everything:
        EXCLUDE="\
          --exclude binary-arm/ --exclude *_arm.deb --exclude *_arm.udeb --exclude disks-arm/ --exclude upgrade-arm/ --exclude *-arm.gz --exclude *arm*.nondebbin.* \
          --exclude binary-hurd-i386/ --exclude *_hurd-i386.deb --exclude *_hurd-i386.udeb --exclude disks-hurd-i386/ --exclude upgrade-hurd-i386/ --exclude *-hurd-i386.gz --exclude *hurd-i386*.nondebbin.* \
          --exclude binary-ia64/ --exclude *_ia64.deb --exclude *_ia64.udeb --exclude disks-ia64/ --exclude upgrade-ia64/ --exclude *-ia64.gz --exclude *ia64*.nondebbin.* \
          --exclude binary-m68k/ --exclude *_m68k.deb --exclude *_m68k.udeb --exclude disks-m68k/ --exclude upgrade-m68k/ --exclude *-m68k.gz --exclude *m68k*.nondebbin.* \
          --exclude binary-mips*/ --exclude *_mips*.deb --exclude *_mips*.udeb --exclude disks-mips*/ --exclude upgrade-mips*/ --exclude *-mips*.gz --exclude *mips*.nondebbin.* \
          --exclude binary-powerpc/ --exclude *_powerpc.deb --exclude *_powerpc.udeb --exclude disks-powerpc/ --exclude upgrade-powerpc/ --exclude *-powerpc.gz --exclude *powerpc*.nondebbin.* \
          --exclude binary-sh*/ --exclude *_sh*.deb --exclude *_sh*.udeb --exclude disks-sh*/ --exclude upgrade-sh*/ --exclude *-sh*.gz --exclude *sh*.nondebbin.* \
          --exclude binary-s390/ --exclude *_s390.deb --exclude *_s390.udeb --exclude disks-s390/ --exclude upgrade-s390/ --exclude *-s390.gz --exclude *s390*.nondebbin.* \
          "
        
        # With a blank EXCLUDE you will mirror the entire archive.
        #EXCLUDE=
        
        # There should be no need to edit anything below this point, unless there
        # are problems.
        
        #-----------------------------------------------------------------------------#
        
        # Note: on some non-Debian systems, hostname doesn't accept -f option.
        # If that's the case on your system, make sure hostname prints the full
        # hostname, and remove the -f option. If there's no hostname command,
        # explicitly replace `hostname -f` with the hostname.
        HOSTNAME=`hostname -f`
        
        LOCK="${TO}/Archive-Update-in-Progress-${HOSTNAME}"
        
        # Get in the right directory and set the umask to be group writable
        #
        cd $TO
        umask 002
        
        # 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
        # Note: on some non-Debian systems, trap doesn't accept "exit" as signal
        # specification. If that's the case on your system, try using "0".
        trap "rm -f $LOCK > /dev/null 2>&1" exit
        
        set +e
        rsync $OPTIONS \
             --exclude "Archive-Update-in-Progress-${HOSTNAME}" \
             --exclude "project/trace/${HOSTNAME}" \
             $EXCLUDE \
             $RSYNC_HOST::$RSYNC_DIR $TO > rsync.log 2>&1
        date -u > "${TO}/project/trace/${HOSTNAME}"
        
        # Note: if you don't have savelog, use any other log rotation facility, or
        # comment this out, the log will simply be overwritten each time.
        #savelog rsync.log > /dev/null 2>&1
        
#------------End Script

-- 
greg, greg@gregfolkert.net

The technology that is
Stronger, better, faster:  Linux

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: