#!/bin/sh # # this script does the setup for a yum repos # X=`date +%H` case "$X" in 02|03|04|05) MINUTES=14400 # During the night we check for 14400 minutes = 10 days ? ;; *) MINUTES=70 # normally we check if there where changes in the directory tree the # last 70 minutes. ;; esac PUBDIR=/home/ftp/pub/ YUMDIR=${PUBDIR}yum IFS=" " # # evaluate arguments # while [ $# -gt 0 ] do case "$1" in -D) DEBUG=-x set $DEBUG shift ;; -a) MINUTES=7200000 shift ;; -m) shift MINUTES=$1 shift ;; -?) echo "Usage: $0 [-D] [-a] [-m ] [-?]" exit ;; *) shift ;; esac done cd ${YUMDIR} umask 0022 # # run yum-arch for each directory # for DIR in `ls -d *.*/*` ; do echo -en "`date +%Y%m%d%H%M%S` ${YUMDIR}/${DIR} " ROWS=`find ${YUMDIR}/${DIR} -follow -cmin -$MINUTES -name "*rpm" | wc -l | sed 's/ //g'` if [ $ROWS = 0 ]; then echo " nothing changed" else cd ${YUMDIR}/${DIR} echo " changes found, rebuilding repository" yum-arch -v . fi done cd ${YUMDIR}