Making Lagtime Update Repositories

Troy Johnson <[email protected]> Mon, 28 Jul 2003 16:42:56 -0500
Newsgroups gmane.linux.redhat.rpm.grab
Message-ID <[email protected]>
GRAB People,

I was thinking I wanted to have some machines automatically updated 
with the latest mirror package updates, but have some other machines lag 
behind for a week (or more).

I whipped up this script (which does need work), and though I'd like to 
just link the '.info' files too, doing so should probably cross the 
Shell/Perl line, and create a way for changes in 'grab' to break this 
script.

*shrug*

 >>>>>>>>>>START>>>>>>>>>>
#!/bin/bash

LS=/bin/ls
FIND=/usr/bin/find
GRAB=/usr/bin/grab
GOPT=--buildrep
VER=9

echo "=== Making Time Lag Links For GRAB Updates==="

for DAYS in 7 14 28 ; do
	MAIN=/var/ftp/pub/redhat/$VER
	LAG=$MAIN/${DAYS}days
	UPDATES=../../updates
	echo "  = $DAYS Day Lag Updates - Red Hat $VER ="
	cd $LAG
	if [ $? == 0 ]; then
		for d in * ; do
			CURRENT=$LAG/$d
			cd $CURRENT
			echo Removing links in $CURRENT
			rm -f $CURRENT/*
			echo Creating links in $CURRENT
			$FIND $UPDATES/$d -mtime +$DAYS -exec ln -s \{\} \;
			$GRAB $GOPT $CURRENT
		done
	else
		echo Error changing to $LAG, skipping $DAYS
	fi
done

echo "=== Time Lag Links Complete ==="
<<<<<<<<<<END<<<<<<<<<<

I'm just posting this here in case someone else can use it, or possibly 
has already completed a better way of getting this job done. Thanks, 
good luck, and a happy day to you.

Troy