From 6f8330ae4e7707fbf36e231197d4998cc8a96a44 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 26 Jul 2017 16:50:49 +0200 Subject: syncrepo.sh: Update lastsync file when lastupdate shows no changes This helps keep the statistics on the Arch Linux website up to date. Signed-off-by: Florian Pritz --- syncrepo.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'syncrepo.sh') diff --git a/syncrepo.sh b/syncrepo.sh index f6c8f5d..0481ea5 100755 --- a/syncrepo.sh +++ b/syncrepo.sh @@ -25,18 +25,21 @@ lastupdate_url="http://rsync.archlinux.org/lastupdate" exec 9>"${lock}" flock -n 9 || exit +if ! stty &>/dev/null; then + QUIET="-q" +fi + +rsync_cmd=(rsync -rtlvH --safe-links --delete-after --progress -h ${QUIET} "--timeout=600" "--contimeout=60" -p \ + --delay-updates --no-motd "--bwlimit=$bwlimit" "--temp-dir=${tmp}") + # if we are called without a tty (cronjob) only run when there are changes if ! tty -s && diff -b <(curl -s "$lastupdate_url") "$target/lastupdate" >/dev/null; then + # keep lastsync file in sync for statistics generated by the Arch Linux website + "${rsync_cmd[@]}" "$source/lastsync" "$target/lastsync" exit 0 fi -if ! stty &>/dev/null; then - QUIET="-q" -fi - -rsync -rtlvH --safe-links --delete-after --progress -h ${QUIET} --timeout=600 --contimeout=60 -p \ - --delay-updates --no-motd --bwlimit=$bwlimit \ - --temp-dir="${tmp}" \ +"${rsync_cmd[@]}" \ --exclude='*.links.tar.gz*' \ --exclude='/other' \ --exclude='/sources' \ -- cgit v1.2.3-24-g4f1b