Starting Duplicati when Windows is shut down


#1

Hi,

I don’t know if this question is right in support.
I wonder if it’s possible to start the backupjob when the user logs out of windows or shuts down the system.

For example if I tell my mother her PC is backed up at 1pm every day and she has to close Outlook while it’s backed up there is a 99,9% chance her pst file would never be backed up. But if the job runs when she loggs off from her Notebook (which is always on powercord) and shuts down windows afterwards there is a 100% chance her pst is backed up…

Best regards

Garbers


#2

I know this isn’t exactly the answer you’re looking for, but if a scheduled backup job passes while the computer is shut down, it runs automatically when the computer starts back up (/when duplicati starts).


#3

It is very hard to schedule stuff to run on log-off/shutdown on Windows for two reasons:

  1. There are no events accessible to the user that you hook up to. This is probably because of the next one :slight_smile:
  2. It is a shutdown/log-off and Windows is broadcasting messages left, right and centre announcing that so software can exit gracefully - not exactly the best time to start new tasks or process.

The developers here will probably be able to confirm, but I am pretty sure you may be able to tap into the Windows API and hook-up to something, however, that is likely not what you are looking for.

If I were in your position, I would create an orchestration script that takes care of stuff (i.e. close Outlook or log your mom off) and then runs Duplicati. You can also leverage the run-script-before and run-script-after advanced options and leave everything to Duplicati.
A combined approach may be best - create an orchestration script that will log-off your mom and run Duplicati and use run-script-after to shutdown the computer. You can then create a shortcut to the script and tell your mom that this is the new shutdown button.

Having said that, are you really sure you want her to keep stuff in a PST file? If her account is on Exchange or Outlook.com it may be better to just leave everything on the server or in the cloud. If her account is with another provider, the same is true but only for mail items, so I understand that you may need the PST for contacts, calendar, etc. Still, tough, there may be a better option…


#4

Is this required? I don’t have Outlook, but VSS (i.e. –snapshot-policy=on) can likely backup that .pst at 1pm. VSS can sometimes go wrong, and Microsoft excludes the .ost deliberately, but it might be the easiest way.

More:
Duplicati and VSS
Troubleshoot backups of Microsoft Outlook data
Is Outlook compatible with Volume Shadow Copy Service?

I’m not expert in Task Scheduler, but Windows is always waking up my desktop to do things, and if you can get a task to run Duplicati from the command line then go back to sleep, that might be an alternative option.