From 394b593576a8c69a4f1e80a91606d85ea92306b2 Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 20 Nov 2025 05:22:08 +0100 Subject: Tidy things up, and only say the important things. --- devuan_package_mirror_sync.sh | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'devuan_package_mirror_sync.sh') diff --git a/devuan_package_mirror_sync.sh b/devuan_package_mirror_sync.sh index 5a87a04..75e23a2 100755 --- a/devuan_package_mirror_sync.sh +++ b/devuan_package_mirror_sync.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # I've not found a way to do this in one rsync call, so here's two. # @@ -21,7 +21,7 @@ set -ef MIRROR_PATH="/srv/mirrors/files.devuan.org" -BEHAVE="ionice -c3 nice -n 19" +BEHAVE="ionice -c3 nice -n 19 flock -n ${MIRROR_PATH}/devuan" # Bits from the rsync 3.2.7 man page. # For remote transfers, a modern rsync uses ssh for its communications, @@ -70,24 +70,25 @@ OPTIONS="--delay-updates -rptSzhhv --no-motd --chown mirrors:www-data -M- # --human-readable, -h output numbers in a human-readable format # --remote-option=OPT, -M send OPTION to the remote side only -# Exclude metadata files. -EXCLUDES="--exclude Packages* \ - --exclude Sources* \ - --exclude Release* \ - --exclude InRelease \ - --exclude Contents-* \ - --exclude Translation-* \ - --exclude ls-lR* \ - --exclude current \ - --exclude .~tmp~" + mkdir -p ${MIRROR_PATH} # The --exclude "/devuan-cd/" is so we don't wipe out the ISO mirror. -time $BEHAVE flock -n ${MIRROR_PATH}/devuan rsync ${OPTIONS} vesta@pkgmaster.devuan.org:~/devuan/ ${MIRROR_PATH} --exclude "/devuan-cd/" $EXCLUDES \ - | grep -Ev '/$|\.svg|\.txt$|\.txt.old$|versionlog\.state|log/sources|aintainers$|skipping non-regular file' | head -n -1 | tail -n +2 -echo "" -time $BEHAVE flock -n ${MIRROR_PATH}/devuan rsync ${OPTIONS} -l --delete-delay vesta@pkgmaster.devuan.org:~/devuan/ ${MIRROR_PATH} --exclude "/devuan-cd/" \ - | grep -Ev '/$|\.svg|\.txt$|\.txt.old$|versionlog\.state|log/sources|aintainers$' | head -n -1 | tail -n +2 +start_time=$(date +%s%3N) +rslt=$( ${BEHAVE} rsync ${OPTIONS} vesta@pkgmaster.devuan.org:~/devuan/ ${MIRROR_PATH} --exclude "/devuan-cd/" \ + --exclude "Packages*" --exclude "Sources*" --exclude "Release*" --exclude "InRelease" --exclude "Contents-*" --exclude "Translation-*" --exclude "ls-lR*" --exclude "current" --exclude ".~tmp~" \ + | grep -Ev '/$|\.svg|\.txt$|\.txt.old$|versionlog\.state|log/sources|aintainers$|/by-hash/|skipping non-regular file' | head -n -4 | tail -n +2 ) +end_time=$(date +%s%3N) ; duration_ms=$((end_time - start_time)) +echo -n "$rslt"; if [ -n "$rslt" ] ; then echo ""; fi +if [ $duration_ms -gt 2000 ] ; then echo -e "Main rsync time in ms: $duration_ms\n"; fi + +start_time=$(date +%s%3N) +rslt=$( ${BEHAVE} rsync ${OPTIONS} -l --delete-delay vesta@pkgmaster.devuan.org:~/devuan/ ${MIRROR_PATH} --exclude "/devuan-cd/" \ + | grep -Ev '/$|\.svg|\.txt$|\.txt.old$|versionlog\.state|log/sources|aintainers$|/by-hash/' | head -n -3 | tail -n +2 ) +end_time=$(date +%s%3N) ; duration_ms=$((end_time - start_time)) +echo -n "$rslt"; if [ -n "$rslt" ] ; then echo ""; fi +if [ $duration_ms -gt 1000 ] ; then echo "Clean up rsync time in ms: $duration_ms"; fi + # These helped - -- cgit v1.1