It looks like --run-script-before and --run-script-after are being fired on the start of a Restore process.
I tested this by writing a script that appends a timestamp to a log file and setting it up to fire as both --run-script-before and --run-script-after on an existing backup job. In the UI if I just start the Restore process (through the job or the main Restore menu item) I end up with two time entries in my log file.
I’m going to flag this as a bug while waiting for confirmation that this isn’t by design.
Edit: I just checked my log file and there are two more sets of time stamps in it, and I don’t recall doing anything else in the UI, so it looks like something is triggering these more than once.
I agree it’s a bug, but after trying to reproduce it, I found some additional information.
Before the actual Restore operation, a few List operations are done.
These List operations also execute the --run-script-before and --run-script-after scripts.
To illustrate this, I created a small script C:\Scripts\duplicatitestscript.bat and called it with the --run-script-before and --run-script-after options:
@echo off
SET EVENTNAME=%DUPLICATI__EVENTNAME%
SET OPERATIONNAME=%DUPLICATI__OPERATIONNAME%
SET CURRENTTIME=%DATE% - %TIME%
SET LOGFILE=C:\SCRIPTS\DUPLICATITESTLOG.TXT
ECHO %CURRENTTIME% >> "%LOGFILE%"
ECHO %EVENTNAME% >> "%LOGFILE%"
ECHO %OPERATIONNAME% >> "%LOGFILE%"
ECHO ---------------------------------------- >> "%LOGFILE%"
This is the output after restoring a single file:
Click to expand
do 19-10-2017 - 17:34:21,08
BEFORE
List
----------------------------------------
do 19-10-2017 - 17:34:21,15
AFTER
List
----------------------------------------
do 19-10-2017 - 17:34:21,24
BEFORE
List
----------------------------------------
do 19-10-2017 - 17:34:21,55
AFTER
List
----------------------------------------
do 19-10-2017 - 17:34:21,62
BEFORE
List
----------------------------------------
do 19-10-2017 - 17:34:23,04
AFTER
List
----------------------------------------
do 19-10-2017 - 17:34:24,81
BEFORE
List
----------------------------------------
do 19-10-2017 - 17:34:26,16
AFTER
List
----------------------------------------
do 19-10-2017 - 17:34:43,41
BEFORE
Restore
----------------------------------------
do 19-10-2017 - 17:34:55,25
AFTER
Restore
----------------------------------------