summaryrefslogtreecommitdiffstats
path: root/syncrepo.sh
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2017-07-26 16:50:49 +0200
committerFlorian Pritz <bluewind@xinu.at>2017-07-26 16:50:49 +0200
commit6f8330ae4e7707fbf36e231197d4998cc8a96a44 (patch)
treec30f5b1fd233a61d2a339131be88c6f9b548436c /syncrepo.sh
parent428e5ee7a20fafd882752cbe34eb37fd5813eecd (diff)
downloadbin-6f8330ae4e7707fbf36e231197d4998cc8a96a44.tar.gz
bin-6f8330ae4e7707fbf36e231197d4998cc8a96a44.tar.xz
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 <bluewind@xinu.at>
Diffstat (limited to 'syncrepo.sh')
-rwxr-xr-xsyncrepo.sh17
1 files changed, 10 insertions, 7 deletions
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' \