Device mount detection (USB or otherwise)

I think allowing both kinds of notifications would be relevant. I personally don’t like to receive too many emails (I tend to ignore them otherwise) and prefer to trust the fact that the server will not crash :slight_smile:.

There are two different use cases for notifications:

  1. Ensuring that Duplicati is running and has not crashed.
  2. Ensuring that each backup has been able to complete within a maximum timeframe (particularly useful for backups to removable or network drives).

For the first, the server could write a completion file somewhere each time it has run successfully and processed everything it had to process without error. And we could have another independent very simple single-purpose crash-proof process that checks for this file and will send a notification if it isn’t found or it is too old. Of course die hard users could still enable canary-style successful backup notifications (or notifications every x days that things are running smoothly).

In my particular case I’d probably like to set up to receive a notification after 2 weeks if my quarterly backup has not been completed (for example due to the external HD not being plugged in: it should tell me the destination drive is missing). And I’d certainly like to receive a notification if Duplicati has not confirmed it is working smoothly for more than 7 days.

You must be a much better coder than I am. :smiley:

Until it’s backed in to Duplicati, you could use a --run-script-after call to write to a text file then an OS scheduled script to make sure said file isn’t stale…

how to trigger an event if a certain usb storage is attached to windows has been described in this heise c’t article (German language) article.
In short:

  1. use the windows event viewer, navigate to Application and Service Protocols / Microsoft / Windows / DriverFrameworks-UserMode / Operational. If there are no events right click “Operational” > “activate protocol”. Attach USB drive, press F5, watch out for new events. Show details, find parameter named “InstanceId”. Copy the value as string and (!) mask all special characters like in HTML (& -> &) => this is your path-string neede in step 2.

  2. Create a new event, set trigger “on event”, edit “user defined” event filter and set to

    <QueryList> <Query Id="0" Path="Microsoft-Windows-DriverFrameworks-UserMode/Operational"> <Select Path="Microsoft-Windows-DriverFrameworks-UserMode/Operational">*[UserData[UMDFHostAddDeviceEnd[InstanceId="PUT_STRING_IN_HERE"]]]</Select> </Query> </QueryList>

replacing PUT_STRING_IN_HERE with the path string generated above. The c’t article mentioned above at the bottom gives a link to a download page providing a sample xml-file for import into Windows event manager.

Two hints: Make sure the path string is set into quotation marks. If you use the xml provided by heise-de: you need to change “…@instance=…” to “…InstanceId=…” as shown above. If you use Duplicati 2.x then you also need to change the command string after importing the mentioned xml. Thanks @glissi who gave this hints in his comment!

With this hints I was able to trigger Duplicati backup by mounting a certain USB device.

1 Like