Advertisement
Guest User

Untitled

a guest
Aug 28th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.05 KB | None | 0 0
  1. #/bin/bash
  2. #script for ubuntu archive mirror
  3. #mirror@dhakacom.com
  4.  
  5. fatal() {
  6.   echo "$1"
  7.   exit 1
  8. }
  9.  
  10. warn() {
  11.   echo "$1"
  12. }
  13.  
  14. # Find a source mirror near you which supports rsync on
  15. # https://launchpad.net/ubuntu/+archivemirrors
  16. # rsync://<iso-country-code>.rsync.archive.ubuntu.com/ubuntu should always work
  17. RSYNCSOURCE=rsync://us.archive.ubuntu.com/ubuntu
  18.  
  19. # Define where you want the mirror-data to be on your mirror
  20. BASEDIR=/var/www/html/ubuntu-archive/
  21.  
  22. if [ ! -d ${BASEDIR} ]; then
  23.   warn "${BASEDIR} does not exist yet, trying to create it..."
  24.   mkdir -p ${BASEDIR} || fatal "Creation of ${BASEDIR} failed."
  25. fi
  26.  
  27. rsync --verbose --recursive --times --links --hard-links \
  28.   --stats \
  29.   --exclude "Packages*" --exclude "Sources*" \
  30.   --exclude "Release*" \
  31.   ${RSYNCSOURCE} ${BASEDIR} || fatal "First stage of sync failed."
  32.  
  33. rsync --verbose --recursive --times --links --hard-links \
  34.   --stats --delete --delete-after \
  35.   ${RSYNCSOURCE} ${BASEDIR} || fatal "Second stage of sync failed."
  36.  
  37. date -u > ${BASEDIR}/project/trace/$(hostname -f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement