Feature request: Better scheduling with Duplicati

Last six months I did some simple bakup tests with Duplicati and was satisfied.
However recently I decided to use Duplicati on some file servers.
My objective was to backup some user shares and a general share several time during the day.
These shares do not change much, but we store our invoices and bank statements in these folders, so if we were e.g. hit by ransomware, the recent the backup the better.
Our company (multiple stores with own servers) are open from 8:00 - 18:00 from monday thru saturday.

I would prefere to backup the data every 2 hour or even every 1 hour, but alas if I choose that with Duplicati, it will keep backing up outside the working our of 8:00 - 18:00.
So as a compromise I backup every 4 hours starting at 02:00. This ensures that I have 3 backups (10:00, 14:00 and 18:00) between 8:00 - 18:00, and 3 backups I do not need at 02:00, 06:00 and 22:00.

Googling I found some I found some backup schedulers from other software.
With the shedulers below, you could choose the days to backup and add when wihin these days the backup should run.

In my case I could select mon, thu, wed, thu, fri and sat and e.g. backup at: 10:00, 12:00, 14:00, 16:00, 18:00 and 20:00.
Even better would be if one could shedule diffirent times for every day, but that would be to much of a stretch for this request :smiley:

https://www.iperiusbackup.net/en/how-to-schedule-automatic-backup-with-iperius/
https://www.iperiusbackup.net/wp-content/uploads/2014/05/How-to-schedule-automatic-backup-with-Iperius-EN.gif

https://www.uranium-backup.com/tutorials/how-to-schedule-a-backup-with-uranium/

Does that create any problem? If nothing changes, a backup version won’t even be uploaded unless the upload-unchanged-backups is set. If a little changes, only the little change is uploaded – plus the file list.

If for some reason the system with Duplicati has to be left up, but Duplicati backups must be stopped, a run-script-before that can map out the desired time policy can suppress the actual backup via exit code:

A pre-backup script should work, exporting the backup job to commandline and use your own scheduler could also do the trick.

I will have a look if this can be used as a work-around. Thanks.

@Kees Commodore, this is worth looking at as a work-around, but I would prefer an advanced scheduling scheme just being part of Duplicati :smiley:

Was looking at ways to schedule and found Cron on wikipedia.
https://en.wikipedia.org/wiki/Cron

This would be a nice way to shedule backup jobs.
The input could be with the use of a GUI, to make it easy for the general users, but it should be easy for Duplicati to keep a table with Cron line + backup job and just execute the backup when the cron time is triggered.

This Cron thing is really well thought out :wave:

and as the article says, is in Unix-like computer operating systems, so isn’t on your Windows systems.
Windows Task Scheduler is used there, but the way to set it up is very different. Duplicati does its own scheduling, which allows it to incorporate things like pause and resume of the backup scheduling, so it becomes more capable than something which is only time based like cron (and likely Task Scheduler).

Here’s an example cmd script that uses the error codes mentioned in @ts678’s post above. I know it isn’t as pretty as if Duplicati’s scheduler had this built in, but it should work.

This checks the current hour and only runs the backup if it’s between 8 and 18. Could be made more robust to handle weekdays/weekends differently.

@echo off

for /f "tokens=1 delims=/:" %%a in ('time /t') do (set _hour=%%a)

if %_hour% lss 8 goto nobackup
if %_hour% gtr 18 goto nobackup

exit 0

:nobackup
exit 1

This may need to be adjusted depending on your locale settings.

1 Like

Yes,offcourse your right, but would it be nice to borrow from other operating systems :slightly_smiling_face:
Because cron is so well thought out, it’s very flexible and I just love flexibility.
Meaning if a shedule system like cron would be implemented into Duplicati, almost every consievable schedule could be made… (at least that’s my idea having looked at cron)…

Thanks for your script. I would like to test this out, but because I am on deadline, installing several machines, I have to test this later…
BTW I too love making different scripts to “automate” things or make live easier for other administrators or users, so I seem to expect the same from programs I use. My fault :smiley: