From 1854677373e519cd46b65fb2f42b995ec2b35fe8 Mon Sep 17 00:00:00 2001 From: Robbie1977 Date: Wed, 26 Aug 2026 12:52:18 +0000 Subject: [PATCH] Do not preserve ownership, mode or directory times when syncing The backup runs as nginx and the archive directories belong to whoever seeded them (or another instance), so rsync -a failed every chgrp/chown with EPERM and reported exit 23 on each run. Ownership and mode on the destination do not matter: rsync creates files as the copying user and nginx only reads its own local copy. File mtimes are still preserved because --update and find -newer depend on them. --- cache-lib.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cache-lib.sh b/cache-lib.sh index 3fca1be..5454217 100644 --- a/cache-lib.sh +++ b/cache-lib.sh @@ -164,7 +164,14 @@ cache_rsync_batch() { src="$1"; dst="$2"; list="$3"; bwlimit="${4:-0}"; tmpdir="${5:-}" # --files-from implies --relative, so `a/bc/` lands at the same # levels path under and the intermediate directories are created. - set -- -a --whole-file --update --modify-window="$CACHE_MODIFY_WINDOW" \ + # Not -a: no -o/-g/-p and no directory times. The archive is NFS, the + # copying user (nginx) does not own the directories another instance or + # the initial seed created there, and chown/chgrp/chmod/utimes on them + # fail with EPERM (exit 23) on every run. Ownership and mode on the + # destination are irrelevant: rsync creates each file as the copying user + # and nginx only ever reads its own local copy. File mtimes (-t) are kept + # because --update and the backup's find -newer rely on them. + set -- -rltD --omit-dir-times --whole-file --update --modify-window="$CACHE_MODIFY_WINDOW" \ --files-from="$list" --quiet if [ -n "$tmpdir" ]; then mkdir -p "$tmpdir"