what does this script do


export ADMINMAIL=ltc-administrators@
export REPOHOME=/srv/localrepo
export DISTROLIST=$REPOHOME/dist-version
export EXCLUDELIST=$REPOHOME/exclude-sync-dirs
export REPOSITORY="mirrors.usinternet.com::centos"
export TIMESTAMP=$(date +%Y%m%d)
export OUTPUTFILE=/tmp/centos-local-repo-sync.$TIMESTAMP
export ERRORFILE=/tmp/centos-local-repo-sync.error.$TIMESTAMP

rsync -rltpDv --stats -h --files-from=${DISTROLIST} --exclude-from=${EXCLUDELIST} ${REPOSITORY} ${REPOHOME} > ${OUTPUTFILE} 2> ${ERRORFILE}

if [ $? -gt 0 ]; then
        cat $OUTPUTFILE | mail -s "ERROR: CentOS Local Repository Sync Job" -a $ERRORFILE $ADMINMAIL

export CHANGECOUNT=$(find /srv/localrepo/ -newer /srv/localrepo/lastrun.rsync | wc -l)

if [ $CHANGECOUNT -gt 0 ]; then
        cat $OUTPUTFILE | mail -s "Updated CentOS Repository Files" $ADMINMAIL

mv -f $OUTPUTFILE /srv/localrepo/lastrun.rsync

Open in new window

Jason YuAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The script uses rsync to synchronise the Centos repository from a Centos mirror to the local site, so that (presumably) hosts can update their packages from the local Centos mirror rather than having to go out to the Internet.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.