Run-script-before-required: no email in case of error

Set up:

  1. docker container linuxserver/duplicati running on Debian GNU/Linux 12 (Raspberry Pi) as root (PUID 0, GUID 0)
  2. Mount a host volume for scrips
  3. Create a new tiny backup job
  4. Add the option “run-script-before-required” pointing to a script on the host
  5. Add email notification options (global section)

Test 1:
Let the script return zero
Result:
Success, respective email sent

Test 2:
Let the script return non-zero
Result:
Backup job fails as expected with respected notification in the logs
No email sent

Expected result:
Whenever a mandatory script fails, an appropriate email should be sent

This looks like it is to do with the module loading order. The run script module throws a OperationAbortException to stop the backup from running. This is handled correctly and all the OnFinish methods are called, but because the mail module was not configured before, it does nothing. The proper way to fix this would probably be to configure all modules before calling OnStart.

I have made a PR that fixes this.