diff options
Diffstat (limited to 'syncrepo.sh')
-rwxr-xr-x | syncrepo.sh | 17 |
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' \ |