Okay, the options works fine, but I get weird warning in every run.
The script "run-postgresql-10-backup.bat" reported error messages: 'auth-password' is not recognized as an internal or external command, operable program or batch file.
There is no “auth-password” command used inside that .bat file.
The storage is normal UNC path like \\10.0.0.100\Backup with filled credentials. The Duplicati instance runs as service in Windows environment.
Also this warning appears for every operation like listing backups etc. Also I use the conditions to check for event and operation name so the whole “logic” of script runs only for BEFORE Backup. So for restore file listing it should done nothing but still the warning appears.
Do you have any idea where the problem can be please?
Yeah, this is a known issue (though I can’t find the topic for it right now). At present the best way to handle this is to have your script \use the Duplicati environment variables to check that %DUPLICATI_OPERATIONNAME% = Backup otherwise abort the job:
Are you test running your commands through the web GUI Command line feature? If so, this is also a known issue where some of the pre-filled parameters are passed even if not needed for the selected command. I usually make it a point to blank out all fields not needed for my specific command and it seems to run OK.
Nothing done in the Command line window is “saved” so don’t worry - you won’t be wiping out your backup job settings or anything like that.
I already have these conditions inside the .bat file, maybe I missed something so the .bat file is below.
if "%EVENTNAME%" == "BEFORE" GOTO ON_BEFORE
IF "%OPERATIONNAME%" == "Backup" GOTO ON_BEFORE_BACKUP
echo Got operation "%OPERATIONNAME%", ignoring
powershell.exe -file "F:\Program Files\PostgreSQL\10.1\run_backup.ps1"
exit /B 0
Your batch file looks good - I think I was misunderstanding the error you were reporting.
You said it provides a warning, is the backup run even if this warning appears?
My guess is that you’re running into a command line parsing issue, but I’m not exactly sure where / why. Specifically, if you export your job as a command line you’ll likely see something like he following:
I’m guessing the “&” characters in the destination connection string are being “eaten” somewhere causing auth-password (and in this example ssh-fingerprint) to look like separate parameters - which Duplicati wouldn’t recognize.
You might want to try simplifying the batch job for testing what’s going on during backup and non-backup tasks. For example:
IF *%DUPLICATI__OPERATIONNAME% EQU *Backup echo Backup>C:\output.txt
IF *%DUPLICATI__OPERATIONNAME% NEQ *Backup echo Not Backup>C:\output.txt
exit /B 0
That should let you look at C:\output.txt after test runs of various commands to make sure the appropriate IF blocks are firing.
Additionally, if the “auth-password” errors go away, then there’s a good chance the (parameter parsing?) issue is being introduced in the powershell call…
Thanks for the command line (and test confirmation) - the exported command looks good to me (though the “/” before the "auth-username parameter looks odd). This still feels like a parsing issue in powershell for some reason…
The run_backup.ps1 powershell file doesn’t do anything with Duplicati, does it?
Am I correct in assuming the job runs fine if you manually do what’s in run_backup.ps1 then manually start the backup job WITHOUT the --run-script-before-required?