What is Duplicati’s behaviour when it can’t connect to the specified FTP server for a scheduled task?
I want to use it to back up my laptop via FTP to a NAS on my home network, but I would like to know what it will do if I’m not home at the scheduled time and the FTP connection fails.
I don’t have FTP set up , so can’t give details on how FTP would fail (there are also two versions available) but the general plan is that it tries as scheduled, gets what it gets, and lack of connection will result in error.
If you are security conscious and the NAS allows, you might consider SFTP. FTP is usually unencrypted and does not validate the identity of the server, so a risk of exposing FTP’s credentials or transferred data exists. Exposure risk can be relieved, respectively, by not reusing passwords, and by having Duplicati encrypt data.
If you wish to ensure you keep backups at somewhat regular intervals (regardless of connectivity) you could schedule them more frequently than needed, then set up backup retention rules to thin them out afterwards.
Thank you, I’ll look at that. There might be a better solution than my current plan:
Rather than using duplicati scheduler, I was going to use windows task scheduler to run the duplicati backup command on connection to the correct network once a day.
I would set a windows task to run once a day at a given time, with the “Start only if the following network connection is available”, and “Run task as soon as possible after a scheduled start is missed” options checked. I’ll need to do some testing to see if its also necessary to use the option to restart the task if it fails every X minutes for Y attempts.
The windows task would run a batch script containing a duplicati backup command.
As of the Win10 Creator Update, it turns out that “Start only if the following network connection is available” is broken and undocumented, or so says stackoverflow. So instead we need to make a custom XML trigger:
This needs two tasks, one to run the backup (and disable the task), one to re-enable the backup task at a certain time each day.
First task: trigger is the custom on event XML I pasted above. Under the “General” tab, we need to select “Run whether user is logged on or not” and “Run with highest privileges” to run as administrator without a UAC popup. This task will run Powershell.exe with the following arguments: -ExecutionPolicy Bypass <pathToScript>
Second task: run once a day at the “backup after” time (say, 8PM), and enable the other task. As with the first task, this one needs “Run whether user is logged on or not” and “Run with highest privileges”. Under settings, we need to check “Run task as soon as possible after a scheduled start is missed” in case the computer is off at this time. Run Powershell.exe -ExecutionPolicy Bypass <pathToScript>
Script:
Enable-ScheduledTask -TaskName "DuplicatiTask_1"
This should run Duplicati once per day, after 8PM, and only on connection to the specified network. I’ve tested all the pieces but not the whole thing, I’ll let you know how it goes later.