fix(backup): harden Google Drive freshness readback
This commit is contained in:
@@ -63,6 +63,22 @@ export BACKUP_DOCKER_CPUS="${BACKUP_DOCKER_CPUS:-1.0}"
|
||||
export BACKUP_DOCKER_MEMORY="${BACKUP_DOCKER_MEMORY:-1g}"
|
||||
export BACKUP_DOCKER_MEMORY_SWAP="${BACKUP_DOCKER_MEMORY_SWAP:-1g}"
|
||||
|
||||
# Cron and service managers do not always preserve HOME. Bind rclone to the
|
||||
# runtime account's config path when the operator did not provide an explicit
|
||||
# RCLONE_CONFIG, without reading or printing the credential-bearing file.
|
||||
bind_rclone_config_to_runtime_user() {
|
||||
[ -z "${RCLONE_CONFIG:-}" ] || return 0
|
||||
command -v getent >/dev/null 2>&1 || return 0
|
||||
|
||||
local runtime_home
|
||||
local candidate
|
||||
runtime_home="$(getent passwd "$(id -u)" 2>/dev/null | awk -F: 'NR == 1 {print $6}')"
|
||||
candidate="${runtime_home}/.config/rclone/rclone.conf"
|
||||
if [ -n "${runtime_home}" ] && [ -r "${candidate}" ]; then
|
||||
export RCLONE_CONFIG="${candidate}"
|
||||
fi
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 日誌函式
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user