Skip to content

Commit f7eb3a7

Browse files
authored
Added v0.30 changes
1 parent dbba5a7 commit f7eb3a7

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

README.md

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ To run the backup automatically, edit the root crontab.
184184
185185
```ini
186186
# =================================================================
187-
# Configuration for rsync Backup Script v0.29
187+
# Configuration for rsync Backup Script v0.30
188188
# =================================================================
189189
# !! IMPORTANT !! Set file permissions to 600 (chmod 600 backup.conf)
190190
@@ -216,6 +216,9 @@ BEGIN_SSH_OPTS
216216
/root/.ssh/id_ed25519
217217
END_SSH_OPTS
218218
219+
# The timeout in seconds for rsync operations.
220+
RSYNC_TIMEOUT=300
221+
219222
# --- Performance ---
220223
# Optional: Limit rsync's bandwidth usage in KiB/s. Leave empty or set to 0 to disable.
221224
# Example: BANDWIDTH_LIMIT_KBPS=5000 (for 5 MB/s)
@@ -301,7 +304,36 @@ END_EXCLUDES
301304
302305
```bash
303306
#!/bin/bash
304-
# ===================== v0.29 - 2025.08.13 ========================
307+
# ===================== v0.30 - 2025.08.13 ========================
308+
#
309+
# Example backup.conf:
310+
# BACKUP_DIRS="/home/user/test/./ /var/www/./"
311+
# BOX_DIR="/backup/"
312+
# BOX_ADDR="[email protected]"
313+
# LOG_FILE="/var/log/backup.log"
314+
# LOG_RETENTION_DAYS=7
315+
# MAX_LOG_SIZE_MB=10
316+
# BANDWIDTH_LIMIT_KBPS=1000
317+
# RSYNC_TIMEOUT=300
318+
# RECYCLE_BIN_ENABLED=true
319+
# RECYCLE_BIN_DIR="recycle_bin"
320+
# RECYCLE_BIN_RETENTION_DAYS=30
321+
# CHECKSUM_ENABLED=false
322+
# NTFY_ENABLED=true
323+
# NTFY_TOKEN="your_token"
324+
# NTFY_URL="https://ntfy.sh/your_topic"
325+
# NTFY_PRIORITY_SUCCESS=3
326+
# NTFY_PRIORITY_WARNING=4
327+
# NTFY_PRIORITY_FAILURE=5
328+
# BEGIN_SSH_OPTS
329+
# -i
330+
# /root/.ssh/id_rsa
331+
# -p22
332+
# END_SSH_OPTS
333+
# BEGIN_EXCLUDES
334+
# *.tmp
335+
# /tmp/
336+
# END_EXCLUDES
305337
#
306338
# =================================================================
307339
# SCRIPT INITIALIZATION & SETUP
@@ -372,7 +404,7 @@ if [ -f "$CONFIG_FILE" ]; then
372404

373405
case "$key" in
374406
BACKUP_DIRS|BOX_DIR|BOX_ADDR|LOG_FILE|LOG_RETENTION_DAYS|\
375-
MAX_LOG_SIZE_MB|BANDWIDTH_LIMIT_KBPS|\
407+
MAX_LOG_SIZE_MB|BANDWIDTH_LIMIT_KBPS|RSYNC_TIMEOUT|\
376408
CHECKSUM_ENABLED|\
377409
NTFY_ENABLED|DISCORD_ENABLED|NTFY_TOKEN|NTFY_URL|DISCORD_WEBHOOK_URL|\
378410
NTFY_PRIORITY_SUCCESS|NTFY_PRIORITY_WARNING|NTFY_PRIORITY_FAILURE|\
@@ -432,7 +464,7 @@ if (( ${#SSH_OPTS_ARRAY[@]} > 0 )); then
432464
fi
433465

434466
RSYNC_BASE_OPTS=(
435-
-aR -z --delete --partial --timeout=60 --mkpath
467+
-aR -z --delete --partial --timeout="${RSYNC_TIMEOUT:-300}" --mkpath --noatime
436468
--exclude-from="$EXCLUDE_FILE_TMP"
437469
-e "$SSH_CMD"
438470
)
@@ -929,6 +961,10 @@ FINAL_MESSAGE=$(printf "%s\n\nSuccessful: %s\nFailed: %s\n\nDuration: %dm %ds" \
929961
"${failed_dirs[*]:-None}" \
930962
$((DURATION / 60)) $((DURATION % 60)))
931963

964+
if [[ ${#FINAL_MESSAGE} -gt 1800 ]]; then
965+
FINAL_MESSAGE=$(printf "%.1800s\n\n[Message truncated, see %s for full details]" "$FINAL_MESSAGE" "$LOG_FILE")
966+
fi
967+
932968
if [[ ${#failed_dirs[@]} -eq 0 ]]; then
933969
log_message "SUCCESS: All backups completed."
934970
if [[ $overall_exit_code -eq 24 ]]; then

0 commit comments

Comments
 (0)