diff --git a/archlinux.sh b/archlinux.sh index 4aafd41..2d6f8a7 100755 --- a/archlinux.sh +++ b/archlinux.sh @@ -9,7 +9,7 @@ fatal() { exit 1 } -home="/store" +home="/store2" target="${home}/mirror/archlinux" tmp="${home}/tmp" lock='/tmp/mirrorsync.lck' @@ -45,6 +45,12 @@ else "${target}" &>> $logfile || fatal "Failed to sync." fi -echo "lastsync: $(date -d @$(cat ${target}/lastsync))" >> $logfile +LAST_SYNC=$(cat ${target}/lastsync) +if [ -z "${LAST_SYNC}" ];then + LAST_SYNC_FORMATTED="UNKNOWN" +else + LAST_SYNC_FORMATTED="$(date -d @${LAST_SYNC})" +fi +echo "lastsync: ${LAST_SYNC_FORMATTED}" >> $logfile diff --git a/raspbian.sh b/raspbian.sh index bcce103..5b1d7b7 100755 --- a/raspbian.sh +++ b/raspbian.sh @@ -19,8 +19,7 @@ source='rsync://archive.raspbian.org/archive' exec 9>"${lock}" flock -n 9 || exit -# only run rsync when there are changes - rsync -rtlvH --safe-links --delete-after --progress -h --timeout=600 --contimeout=60 -p \ + rsync -rtlvHq --safe-links --delete-after --progress -h --timeout=600 --contimeout=60 -p \ --delay-updates --no-motd \ ${source} \ "${target}" &>> $logfile || fatal "Failed to sync." diff --git a/ubuntu_releases.sh b/ubuntu_releases.sh index a677bcb..e5112d1 100755 --- a/ubuntu_releases.sh +++ b/ubuntu_releases.sh @@ -12,18 +12,23 @@ warn() { # Find a source mirror near you which supports rsync on # https://launchpad.net/ubuntu/+cdmirrors # rsync://.rsync.releases.ubuntu.com/releases should always work -#RSYNCSOURCE=rsync://se.rsync.releases.ubuntu.com/releases +RSYNCSOURCE=rsync://se.rsync.releases.ubuntu.com/releases #RSYNCSOURCE=rsync://ftp.uninett.no/ubuntu-iso -RSYNCSOURCE=rsync://ubuntu.uib.no/ubuntu-releases/ +#RSYNCSOURCE=rsync://ubuntu.uib.no/ubuntu-releases/ # Define where you want the mirror-data to be on your mirror -BASEDIR=/store/mirror/ubuntu/releases/ +BASEDIR=/store2/mirror/ubuntu-releases/ if [ ! -d ${BASEDIR} ]; then warn "${BASEDIR} does not exist yet, trying to create it..." mkdir -p ${BASEDIR} || fatal "Creation of ${BASEDIR} failed." fi +#rsync -v --progress --stats --recursive --times --links --hard-links \ +# --stats --delete-after \ +# ${RSYNCSOURCE} ${BASEDIR} + + rsync -q --recursive --times --links --hard-links \ --stats --delete-after \ ${RSYNCSOURCE} ${BASEDIR} &>> /var/log/mirror/ubuntu_releases.log || fatal "Failed to rsync from ${RSYNCSOURCE}."