-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrsync_config.sh
More file actions
97 lines (86 loc) · 4.6 KB
/
rsync_config.sh
File metadata and controls
97 lines (86 loc) · 4.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
#set -x # Uncomment for debugging (trace mode)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # Configuration file for Rsync to or from a remote server # #
# # This file is intended to be sourced by rsync_replication.sh # #
# # Contains user-adjustable variables for replication and retention # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
####################
# Source for replication (local if push, remote if pull)
# - These are the directories from where files will be synced.
# - Note: This should be the full path to the source directories.
# - In push mode: they're the local sources.
# - In pull mode: they're the remote sources.
####################
source_directories=("/path/to/source/directory1" "/path/to/source/directory2") # Can be one or multiple directories (e.g., "/mnt/data1" "/mnt/data2")
####################
# Destination for replication (local if pull, remote if push)
# - This is the directory to where files will be synced.
# - Note: This should be the full path to the destination directory.
# - In push mode: it's the remote destination.
# - In pull mode: it's the local destination.
####################
destination_directory="/path/to/destination/directory" # (e.g., "/mnt/backup/rsync")
####################
# Rsync replication variables
# - rsync_type: Determines whether the sync is incremental or full.
# - rsync_mode: Defines the direction of the sync: "push" (local to remote) or "pull" (remote to local).
####################
rsync_type="incremental" # "incremental" or "mirror"
rsync_mode="push" # "push" or "pull"
####################
# Rsync flags (user-defined)
# - rsync_short_args: Short rsync arguments (e.g., "-a", "-v", "-z").
# - rsync_long_args: Long rsync arguments (e.g., "--delete", "--checksum").
# - Note: If rsync_type is set to incremental --link_dest will be added automatically
# - These flags will be applied based on the replication type.
####################
rsync_retries=3 # Number of times to retry on failure
local_rsync_short_args="-aHA" # Default short arguments for local replication only
local_rsync_long_args="--delete --numeric-ids --delete-excluded --delete-missing-args --checksum --partial --inplace" # Default long arguments for local replication only
remote_rsync_short_args="-aHvzA" # Default short arguments for remote replication only
remote_rsync_long_args="--delete --numeric-ids --delete-excluded --delete-missing-args --checksum --partial --compress-level=1" # Default long arguments for remote replication only
####################
# Remote replication variables
# - remote_replication: Can be "yes" for remote replication or "no" for local replication.
# - remote_user: Username for remote server.
# - remote_server: Remote server address.
####################
remote_replication="no" # Set to "yes" for remote replication, "no" for local replication
remote_user="remote_username" # Username for remote server (e.g., root)
remote_server="remote_server_address" # IP or hostname (e.g., 192.168.1.200)
####################
# Retention Policy
# - Choose the retention policy: time, count, or off.
# - time: Deletes backups older than a specified number of days.
# - count: Keeps only the latest X backups.
# - off: No backups are deleted.
####################
retention_policy="count" # "time", "count", or "off"
backup_retention_days=30 # Maximum days for time-based retention
backup_retention_count=10 # Maximum number for count-based retention
####################
# Logging
# - How log messages will be saved.
####################
use_syslog="yes" # "yes" to send logs to syslog/journald, "no" to disable logging
####################
# Logging Level
# - Supported: DEBUG, INFO, WARN, ERROR
# - Controls which messages are actually logged by log_message().
# DEBUG: log everything
# INFO: log INFO/WARN/ERROR
# WARN: log WARN/ERROR
# ERROR: log only ERROR
####################
LOG_LEVEL="INFO"
####################
# Command-Line Concurrency (for optional parallel runs)
####################
concurrency=2
####################
# In-Progress Tracking
# - This file will store paths to any .inprogress directories
# so they can be cleaned up upon interruption or script exit.
####################
partial_inprogress_list_file="/tmp/rsync_inprogress.list"