Fetch sallinen.debian.org snapshot backups from port 5473
[mirror/dsa-puppet.git] / modules / postgres / templates / backup_server / postgres-make-base-backups.erb
index 8b34f48..b0d7d32 100755 (executable)
@@ -58,7 +58,7 @@ log() {
 format_timedelta() {
     local secs="$1"; shift
     if [ "$secs" -ge 86400 ]; then
-        printf '%d%02d:%02d:%02d\n' $(($secs/3600/24)) $(($secs/3600%24)) $(($secs/60%60)) $(($secs%60))
+        printf '%d+%02d:%02d:%02d\n' $(($secs/3600/24)) $(($secs/3600%24)) $(($secs/60%60)) $(($secs%60))
     else
         printf '%02d:%02d:%02d\n' $(($secs/3600)) $(($secs/60%60)) $(($secs%60))
     fi
@@ -130,14 +130,14 @@ while read host port username  cluster version; do
                         # get a "randomish" but stable value for this backup run
                         val=$(echo "$MYHOSTNAME-$host-$port-$mtime" | sha256sum | head -c 8)
                         val=$((16#$val))
-                        valmod=$(($val % $DELTA_WAIT_SUCCESS))
-                        after_min=$((delta - MIN_WAIT_SUCCESS))
-                        if [ "$after_min" -lt "$valmod" ]; then
+                        rnd_cuttoff=$(($val % $DELTA_WAIT_SUCCESS))
+                        age_after_min=$((delta - MIN_WAIT_SUCCESS))
+                        if [ "$age_after_min" -lt "$rnd_cuttoff" ]; then
                             runme=0
-                            log "Skipping $host:$port $version/$cluster because random computer says wait ($after_min < $valmod)."
+                            log "Skipping $host:$port $version/$cluster because random computer says wait ([$(format_timedelta "${age_after_min}") < $(format_timedelta "${rnd_cuttoff}") (< $(format_timedelta "${DELTA_WAIT_SUCCESS}"))] + $(format_timedelta "${MIN_WAIT_SUCCESS}"))."
                         else
                             runme=1
-                            log "Planning to run $host:$port $version/$cluster because random computer says so ($after_min >= $valmod)."
+                            log "Planning to run $host:$port $version/$cluster because random computer says so ($(format_timedelta "${age_after_min}") >= $(format_timedelta "${rnd_cuttoff}"))."
                         fi
                     fi
                 fi
@@ -165,6 +165,7 @@ bmdb1.debian.org    5436    debian-backup           wannabuild      9.6
 bmdb1.debian.org       5440    debian-backup           debsources      9.6
 fasolo.debian.org      5433    debian-backup           dak             9.6
 sibelius.debian.org    5433    debian-backup           snapshot        9.4
+sallinen.debian.org    5473    debian-backup           snapshot        9.6
 <%- if @hostname != "backuphost" -%>
 moszumanska.debian.org 5432    debian-backup           main            9.1
 <%- end -%>