Hi, I would say I am well versed in Linux and understand quoting. It was late, and I could have stated by case better, I suppose. So let me clarify ā¦
(TLDR, Iāve solved it, but the documentation needs tweaking.)
Iām using the GUI to set up. In it, Iāve added run-script-before-required and also a run-script-after. (I understand the exit codes and their implication. The script however, runs from the CLI with an exit code of 0.) Iāve also added the run-script-timeout option to 60 minutes, and then checked the box on run-script-with-arguments.
The description on run-script-with-arguments states the following:
This option enables the use of script arguments. If this option is set, the script arguments are treated as commandline strings. Use single or double quotes to separate arguments.
Default value: āfalseā
Lastly, when I look at the example script, /usr/lib/duplicati/run-script-example.sh, it states the following:
# --run-script-with-arguments = <boolean>
# If set to true, the script path will be parsed as a command line, and the
# arguments will be passed to the script. If set to false (default),
# the script path will used as a single path.
# Use double- or single-quotes to pass arguments with spaces.
# Example: --run-script-before="\"/path to/script.sh\" \"arg1 \" arg2"
The last line now is the confusing example to which Iām referring.
"\"/path to/script.sh\" \"arg1 \" arg2"
Iāve managed to fix the fault so that the script runs successfully. For those making the journey, let me elaborate on what I had to do:
I am running
https://raw.githubusercontent.com/dguerri/LibVirtKvm-scripts/master/fi-backup.sh
So in my run-script-before-required field, I enter
/usr/local/bin/fi-backup -q -v all
If I run the job, in the log for the job after it runs, I get
2025-02-09 01:03:34 +02 - [Error-Duplicati.Library.Main.Controller-FailedOperation]: The operation Backup has failed with error: The script ā/usr/local/bin/fi-backup.shā returned with exit code 1
UserInformationException: The script ā/usr/local/bin/fi-backup.shā returned with exit code 1
I decided to run the command from the command line, and then tested the exit code ā¦ sigh ā¦ facepalm.
# echo $?
1
I have multiple Virtual Machines, but not all of them are running. If I ran it against the only VM thatās running (and is normally always on), I got:
# echo $?
0
So with that hurdle crossed, I had to figure out how the quoting process actually should be. I must note here that the documentation in the /usr/lib/duplicati/run-script-example.sh file needs to be fixed. It is atrocious.
I got the job to run successully when I used the line:
"/usr/local/bin/fi-backup.sh" "-q" "-v" "MyRunningVM"
Thank you for bearing with me an being an ear to bounce things off of.