[CentOS] Starting a Local CentOS Mirror

Jason Pyeron jpyeron at pdinc.us
Thu Jun 26 22:12:30 UTC 2008


[root at host67 mirrors]# cat centos.sh
#!/bin/bash

lockfile=$0.lck

unset interactive
unset verbose
interval="20 hours"
verbose="-q"

while [ "$1" != "" ]
do case $1 in

        --bwlimit=*)
                limit="--bwlimit=64"
        ;;
        --interactive)
                interactive=true
        ;;
        -t)
                interval="$2"
                shift
        ;;
        --prune)
                export prune="--delete-excluded"
        ;;
        -v)
                verbose="-v -v --progress"
                interactive=true
        ;;
        *)
                echo "Usage: $0"
                exit 1
esac

shift

done


if ( set -o noclobber; echo "$$" > "$lockfile") 2> /dev/null;

then

   trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT

#   echo \
   rsync -azH \
   --delete \
   rsync://mirrors.kernel.org/centos/ \
   --exclude-from=centos.excludes \
   $verbose \
   $limit \
   $prune \
   centos/


   rm -f "$lockfile"
   trap - INT TERM EXIT


   if [ "$interactive" != "true" ]
   then

        export limit
        export interval
        echo $0 | at now + 20 hours > /dev/null 2> /dev/null

   fi

fi
[root at host67 mirrors]# cat centos.excludes
/2/
/2.1/
/3/
/3.0/
/3.1/
/3.2/
/3.3/
/3.4/
/3.5/
/3.6/
/3.7/
/3.8/
/3.9/
/5.0/
*/alpha/
*/s390x/
*/s390/
*/ia64/
*/SRPMS/*.iso
[root at host67 mirrors]#


--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information. If you
have received it in error, purge the message from your system and
notify the sender immediately.  Any other use of the email by you 
is prohibited. 





More information about the CentOS mailing list