Run exe on Successful backup

Is there a way to run Pre/Post commands before backups?

Specifically, what i’m interested in, is I would like to run a specific exe depending on whether or not the backup was a success.

Example
Backup 1 - Failed - Run failed.exe
Backup 1 - Success - Run success.exe

Is this possible?

You can use the options --run-script-after to execute a script after a backup is completed (successful or unsuccessful).
I think a script like this could do the trick:

@echo off
set "ProgramSuccess=C:\Prog\Prog1.exe"
set "ProgramFail=C:\Prog\Prog2.exe"
set "Tempfile=%Temp%\_Duplicati_Result.tmp"
if exist "%Tempfile%" del "%Tempfile%"
type "%DUPLICATI__RESULTFILE%" >> "%Tempfile%"
for /f "tokens=1,2 usebackq delims=: " %%a in ("%Tempfile%") do (
  if /i "%%a"=="ParsedResult" (
    if /i "%%b"=="Success" (
      start "%ProgramSuccess%"
    ) else (
      start "%ProgramFail%"
    )
  )
)

WARNING: I didn’t test this script, use at your own risk!
You can find some example scripts here:

1 Like

Preson_Barnes, did this work for you?

If so, feel free to click the “checkmark” box in the reply that did the trick - this can help other users with the same question narrow in on a known working solution!
image