"run-script-after" only if backup finished - how?

Hi, I am using “run-script-after” - but the script is also running, when I abort backup, which I often do. I don’t want to run the script in such a case. Is there some kind of error levels or environment variables which I can use?

In a general sense, all the Duplicati options are exposed as environment variables prefixed with “DUPLICATI__” and, due to some some env. variables not allowing dahes, all dashes (-) replaced with underscores (_).

So if you’re running a DOS batch file you could get to your --throttle-upload setting by using %DUPLICATI__throttle_upload%.

There are also some special non-option vairables that are probably what you’re intersted in:

  • DUPLICATI__EVENTNAME = when script was triggered such as “BEFORE” or “AFTER”
  • DUPLICATI__OPERATIONNAME = operation, such as “Backup”, “Cleanup”, “Restore”, etc.
  • DUPLICATI__RESULTFILE = path to file in which result data is stored
  • DUPLICATI__REMOTEURL = “URL” target backend
  • DUPLICATI__LOCALPATH = path to folders being backed up or restored
  • DUPLICATI__PARSED_RESULT = run result such as “Unknown”, “Success”, “Warning”, “Error”, or “Fatal”

So in your case (and assuming a DOS batch file) I’m guessing your script should start with something along the lines of if *%DUPLCATI__PARSED_RESULT%* NEQ *Success* goto :EOF (or something like that).

1 Like

Hey thanks… Yes I am running a .cmd file on Win7. Will need to test later. %DUPLICATI__PARSED_RESULT% returned an empty string, maybe it’s %DUPLICATI–PARSED-RESULT% … or I’ll send the output of “set” to a file to see what actually exists. I hope the variables operate in a global scope…

echo “%DUPLICATI–PARSED-RESULT%”>"%temp%\dup1.txt"
echo “%DUPLICATI-PARSED-RESULT%”>"%temp%\dup2.txt"
echo “%DUPLICATI__PARSED_RESULT%”>"%temp%\dup3.txt"
echo “%DUPLICATI_PARSED_RESULT%”>"%temp%\dup4.txt"

All files only have the “” characters in them. I.e., all variables were empty in the script.

It does not work this way :frowning:

The DUPLICATI__PARSED_RESULT status variable was introduced in v2.0.2.3-
If you’re in the Experimental or Beta update channel, you probably use a version number that’s below
As a workaround, you can use a script similar to this one to pull the parsed result from the result file:

Ah, there is a file, yes I can use this… I’m loving doing cmd magic :slight_smile: Yes I am on experimental.

Btw I think Duplicati UI should show more support as for this topic.