add random delay before execution

This commit is contained in:
Ludovic Cartier
2026-05-30 11:35:19 +02:00
parent 11cbea16ee
commit 1a4b5d3c54
2 changed files with 9 additions and 0 deletions
+1
View File
@@ -1,5 +1,6 @@
---
pbs_repo_key: "https://enterprise.proxmox.com/debian/proxmox-release-{{ ansible_distribution_release }}.gpg"
pbs_random_delay: 900 # 15 minutes in seconds
pbs_repo_no_subscription: "deb [signed-by=/etc/apt/trusted.gpg.d/proxmox-release-{{ ansible_distribution_release }}.gpg] http://download.proxmox.com/debian/pbs-client {{ ansible_distribution_release }} main"
backup_mysql_host: ""
+8
View File
@@ -3,6 +3,14 @@
[ ! -f /usr/bin/proxmox-backup-client ] && echo "proxmox-backup-client is not installed: exiting." && exit 1
{% if pbs_random_delay | int > 0 %}
## random delay to avoid PBS connection flood ##
delay=$((RANDOM % {{ pbs_random_delay }}))
echo "Sleeping ${delay}s before starting backup (max delay: {{ pbs_random_delay }}s)..."
sleep $delay
## end of random delay ##
{% endif %}
today=`date +%Y-%m-%d`
backup_dir={{ backup_dir }}
backup_local_retention={{ backup_local_retention }}