Created
June 22, 2014 07:51
-
-
Save bigeagle/ce007231172d8f04cdbb to your computer and use it in GitHub Desktop.
debmirror ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| CWD="/home/bigeagle/scripts/mirror" | |
| SYNC_HOME="/home/mirror" | |
| SYNC_FILES="$SYNC_HOME/ubuntu" | |
| SYNC_LOCK="$SYNC_HOME/ubuntu.lck" | |
| #SYNC_SERVER="rsync://mirrors.6.tuna.tsinghua.edu.cn/ubuntu/" | |
| #SYNC_SERVER="rsync://mirrors6.ustc.edu.cn/ubuntu/" | |
| LOG_FILE="/tmp/ubuntu.log" | |
| [ -f $SYNC_LOCK ] && exit 1 | |
| touch $SYNC_LOCK | |
| echo ">> Starting sync on $(date --rfc-3339=seconds)" > $LOG_FILE | |
| arch="i386,amd64" | |
| sections="main,main/debian-installer,multiverse,restricted,universe" | |
| dists="precise,precise-backports,precise-proposed,precise-updates,precise-security,trusty,trusty-backports,trusty-proposed,trusty-updates,trusty-security" | |
| server="mirrors6.ustc.edu.cn" | |
| inPath="/ubuntu" | |
| proto="rsync" | |
| outpath="$SYNC_FILES" | |
| debmirror -h $server -a $arch --no-source -s $sections -d $dists -r $inPath -e $proto --verbose $outpath >> $LOG_FILE | |
| date --rfc-3339=seconds > "$SYNC_FILES/lastsync" | |
| echo ">> Finished sync on $(date --rfc-3339=seconds)" >> "$LOG_FILE" | |
| rm -f "$SYNC_LOCK" | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment