aboutsummaryrefslogtreecommitdiffstats
path: root/devuan_package_mirror_sync.sh
diff options
context:
space:
mode:
Diffstat (limited to 'devuan_package_mirror_sync.sh')
-rwxr-xr-xdevuan_package_mirror_sync.sh35
1 files changed, 18 insertions, 17 deletions
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 @@
1#!/bin/bash 1#!/usr/bin/env bash
2 2
3# I've not found a way to do this in one rsync call, so here's two. 3# I've not found a way to do this in one rsync call, so here's two.
4# 4#
@@ -21,7 +21,7 @@
21set -ef 21set -ef
22 22
23MIRROR_PATH="/srv/mirrors/files.devuan.org" 23MIRROR_PATH="/srv/mirrors/files.devuan.org"
24BEHAVE="ionice -c3 nice -n 19" 24BEHAVE="ionice -c3 nice -n 19 flock -n ${MIRROR_PATH}/devuan"
25 25
26# Bits from the rsync 3.2.7 man page. 26# Bits from the rsync 3.2.7 man page.
27# For remote transfers, a modern rsync uses ssh for its communications, 27# 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-
70# --human-readable, -h output numbers in a human-readable format 70# --human-readable, -h output numbers in a human-readable format
71# --remote-option=OPT, -M send OPTION to the remote side only 71# --remote-option=OPT, -M send OPTION to the remote side only
72 72
73# Exclude metadata files. 73
74EXCLUDES="--exclude Packages* \
75 --exclude Sources* \
76 --exclude Release* \
77 --exclude InRelease \
78 --exclude Contents-* \
79 --exclude Translation-* \
80 --exclude ls-lR* \
81 --exclude current \
82 --exclude .~tmp~"
83 74
84mkdir -p ${MIRROR_PATH} 75mkdir -p ${MIRROR_PATH}
85# The --exclude "/devuan-cd/" is so we don't wipe out the ISO mirror. 76# The --exclude "/devuan-cd/" is so we don't wipe out the ISO mirror.
86time $BEHAVE flock -n ${MIRROR_PATH}/devuan rsync ${OPTIONS} vesta@pkgmaster.devuan.org:~/devuan/ ${MIRROR_PATH} --exclude "/devuan-cd/" $EXCLUDES \ 77start_time=$(date +%s%3N)
87 | grep -Ev '/$|\.svg|\.txt$|\.txt.old$|versionlog\.state|log/sources|aintainers$|skipping non-regular file' | head -n -1 | tail -n +2 78rslt=$( ${BEHAVE} rsync ${OPTIONS} vesta@pkgmaster.devuan.org:~/devuan/ ${MIRROR_PATH} --exclude "/devuan-cd/" \
88echo "" 79 --exclude "Packages*" --exclude "Sources*" --exclude "Release*" --exclude "InRelease" --exclude "Contents-*" --exclude "Translation-*" --exclude "ls-lR*" --exclude "current" --exclude ".~tmp~" \
89time $BEHAVE flock -n ${MIRROR_PATH}/devuan rsync ${OPTIONS} -l --delete-delay vesta@pkgmaster.devuan.org:~/devuan/ ${MIRROR_PATH} --exclude "/devuan-cd/" \ 80 | grep -Ev '/$|\.svg|\.txt$|\.txt.old$|versionlog\.state|log/sources|aintainers$|/by-hash/|skipping non-regular file' | head -n -4 | tail -n +2 )
90 | grep -Ev '/$|\.svg|\.txt$|\.txt.old$|versionlog\.state|log/sources|aintainers$' | head -n -1 | tail -n +2 81end_time=$(date +%s%3N) ; duration_ms=$((end_time - start_time))
82echo -n "$rslt"; if [ -n "$rslt" ] ; then echo ""; fi
83if [ $duration_ms -gt 2000 ] ; then echo -e "Main rsync time in ms: $duration_ms\n"; fi
84
85start_time=$(date +%s%3N)
86rslt=$( ${BEHAVE} rsync ${OPTIONS} -l --delete-delay vesta@pkgmaster.devuan.org:~/devuan/ ${MIRROR_PATH} --exclude "/devuan-cd/" \
87 | grep -Ev '/$|\.svg|\.txt$|\.txt.old$|versionlog\.state|log/sources|aintainers$|/by-hash/' | head -n -3 | tail -n +2 )
88end_time=$(date +%s%3N) ; duration_ms=$((end_time - start_time))
89echo -n "$rslt"; if [ -n "$rslt" ] ; then echo ""; fi
90if [ $duration_ms -gt 1000 ] ; then echo "Clean up rsync time in ms: $duration_ms"; fi
91
91 92
92 93
93# These helped - 94# These helped -