summaryrefslogtreecommitdiff
blob: c9df9a379d72e0ac811b66c56e25d3b7c162e5d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash

TRGDIR="/path/to/rsync0-prefix-tree"
LOCALDIR="/path/to/master-rsync-tree"

echo "($(date +"%F %R")) will refresh snapshot"

# synchronise the target
rsync -vca --delete --exclude=snapshots/ \
	"${LOCALDIR}"/ ${TRGDIR}/ > /var/tmp/rsync-updates.log || exit 1

PUBLICDIR=
case $(hostname) in
    disabled)
        PUBLICDIR="somehost::gentoo-portage-prefix-push"
        ;;
esac
# switch the active rsync1 mirror
if [[ -n ${PUBLICDIR} ]] ; then
    rsync -vca --delete "${TRGDIR}"/ "${PUBLICDIR}"/
fi

echo "($(date +"%F %R")) rsync done"