#!/bin/bash home="$(dirname "$(readlink -f $0)")" target="${home}/repo" tmp="${home}/tmp" lock='/tmp/mirrorsync.lck' source='pkgbuild.com::packages/' [ ! -d "${target}" ] && mkdir -p "${target}" [ ! -d "${tmp}" ] && mkdir -p "${tmp}" [ -f "${lock}" ] && exit 1 touch "${lock}" trap "rm -f '${lock}'" EXIT INT TERM rsync -rtlvH --safe-links --delete-after --progress -h \ --delay-updates --no-motd --bwlimit=1000 \ --temp-dir="${tmp}" \ --exclude='*.links.tar.gz' \ --exclude='*.old' \ --exclude='/other' \ --exclude='/sources' \ --exclude='/iso' \ ${source} \ "${target}" echo "Last sync was $(date -d @$(cat ${target}/lastsync))"