Backup failing when laptop waking up from sleep

Please describe what you are doing to trigger the bug:

Waking up the computer from sleep (it was in sleep mode overnight)

Please describe what you expect to happen (but doesn’t):

Duplicacy should run (and complete) the missed backup jobs

Please describe what actually happens (the wrong behaviour):

Backup fails likely because it is trying to run a job before the wifi adapter connects. Could you introduce a configurable delay? I discovered that the first 3 jobs failed (2 backup jobs and 1 prune job) but the subsequent prune job and 2 check jobs did run.
Running backup command from C:\ProgramData/.duplicacy-web/repositories/localhost/0 to back up E:/xxxxxxxx
Options: [-log backup -storage xxxxx -stats]
2020-09-06 11:11:05.965 INFO REPOSITORY_SET Repository set to X:/xxxxx

2020-09-06 11:11:06.319 INFO STORAGE_SET Storage set to b2://xxxxxxxx
2020-09-06 11:11:06.340 ERROR STORAGE_CREATE Failed to load the Backblaze B2 storage at b2://xxxxxxxx: Post https://api.backblazeb2.com/b2api/v1/b2_authorize_account: dial tcp: lookup api.backblazeb2.com: no such host
Failed to load the Backblaze B2 storage at b2://xxxxxxxx: Post https://api.backblazeb2.com/b2api/v1/b2_authorize_account: dial tcp: lookup api.backblazeb2.com: no such host

Duplicacy should probably implement some retry mechanism; but in the meantime you can add prebackup script where you would wait for the connection availability:

#!/bin/bash
target='backblaze.com'
port='443'
retry=10

while [[ ! $(nc -zv ${target} ${port} 2>&1)  =~ 'succeeded' ]]
do
    echo "Waiting for the connection to become available... $retry"
    sleep 1
    [[ $((--retry)) -eq 0 ]] && exit 1
done

exit 0

Returning 0 will allow backup to proceed, returning 1 will abort it.

2 Likes

Smart idea, very smart. I made a powershell script a few years ago that did exactly that. Should not be hard to cook it up even if cannot find it anymore. It is a little work to iron out the kinks on Duplicacy but it is getting there.

I do feel I do not trust it quite enough for production use but I am eager to switch over!