Jason Yu
asked on
what does this script do
#!/bin/sh
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
fi
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
fi
mv -f $OUTPUTFILE /srv/localrepo/lastrun.rsync
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.