[CentOS-mirror] Rsync script problems

Matt Shields mattboston at gmail.com
Mon Apr 16 18:44:06 UTC 2007


Can someone see why when I run this script it tries to pull ALL
versions instead of just 4 & 5?  Also, what would I add if I wanted to
exclude SRPMS, alpha, ppc, s390, & s390x.

#!/bin/bash

RSYNC="/usr/bin/rsync"                  # file location of rsync
FLAGS="-avz --bwlimit=512"              # rsync flags
MIRROR="us-msync.centos.org::CentOS"    # rsync mirror
REPO="/var/storage/install/CentOS"      # directory to store files
INCLUDE="--include='timestamp.txt' --include='TIME'
--include='RPM-GPG-KEY-centos4' --include='4.4/' --include='4.3/'
--include='4.2/' --include='4.1/' --include='4/' --include='4.0/'
--include='5/' --include='5.0/'"
EXCLUDE="--exclude '/*'"

if [ -f "/var/run/centos-mirror.pid" ]; then
   RUNPID=`cat /var/run/centos-mirror.pid`
   if ps -p $RUNPID; then
      echo "Mirror is already running..."
      exit 1
   else
      echo "Mirror pid found but process dead, cleaning up"
      rm -f /var/run/centos-mirror.pid
   fi
else
   echo "No Mirror Process Detected"
fi
echo $$ > /var/run/centos-mirror.pid

echo Rsyncing...
$RSYNC $FLAGS $EXCLUDE $INCLUDE $MIRROR $REPO
rm -f /var/run/centos-mirror.pid
exit 0

Thanks, Matt



More information about the CentOS-mirror mailing list