File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 88
99# Constants
1010readonly RCLONE_CONCURRENCY=2
11+ readonly RCLONE_CONFIG_DIR=/etc/rclone
12+ readonly RCLONE_CONFIG_PATH=" ${RCLONE_CONFIG_DIR} /rclone.conf"
1113readonly RCLONE_CHUNK_SIZE=16M
1214readonly RCLONE_TIMEOUT=30s
1315
16+ rclone_cmd () {
17+ rclone --config=" $RCLONE_CONFIG_PATH " $@
18+ }
19+
20+ #
21+ # === Setup ===
22+ #
23+
24+ rclone_bootstrap_config () {
25+ mkdir -p " $RCLONE_CONFIG_DIR "
26+ rclone_cmd config touch > /dev/null 2>&1
27+ chmod a+r $RCLONE_CONFIG_PATH
28+ }
29+
1430#
1531# === RDB Backup Functions ===
1632#
@@ -20,7 +36,7 @@ readonly RCLONE_TIMEOUT=30s
2036# - Target
2137rclone_copy_url () {
2238 # Note: limit memory use by setting low concurrency & chunk size
23- rclone copyurl " $1 " " $2 " \
39+ rclone_cmd copyurl " $1 " " $2 " \
2440 --low-level-retries 5 \
2541 --no-check-certificate \
2642 --progress \
Original file line number Diff line number Diff line change 22
33SCRIPT_DIR=$( cd " $( dirname " $0 " ) " && pwd)
44. " ${SCRIPT_DIR} /../other/lib/_common.sh"
5+ . " ${SCRIPT_DIR} /../other/lib/rclone.sh"
56
67# Configure rclone tool with a set of S3 credentials
78#
@@ -16,8 +17,11 @@ SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
1617# Input validation
1718require_env_vars S3_PROVIDER S3_ACCESS_KEY_ID S3_SECRET_ACCESS_KEY S3_REGION S3_ENDPOINT
1819
20+ echo " Configuring rclone remote…"
21+
1922# Create configuration, will be used by later rclone invocations
20- rclone config create s3-remote s3 \
23+ rclone_bootstrap_config
24+ rclone_cmd config create s3-remote s3 \
2125 provider " $S3_PROVIDER " \
2226 access_key_id " $S3_ACCESS_KEY_ID " \
2327 secret_access_key " $S3_SECRET_ACCESS_KEY " \
You can’t perform that action at this time.
0 commit comments