Run Command Line Script from GUI

Good day,
I created a command line backup script to be able to select a specific sub-directory based on last created.
The script works fine.
I then created a ‘dummy’ backup via the gui so I could use the native scheduler and just run the the script with “–run-script-after=”.

The dummy backup runs, but when it calls the script it throws an error… which i think it’s permissions related.

(System.String path, Duplicati.Library.Main.Options options) [0x00000] in <9cab5b8f1b4f49ec980acae8e278968b>:0 at Duplicati.Library.Main.Operation.BackupHandler.RunAsync (System.String[] sources, Duplicati.Library.Utility.IFilter filter, System.Threading.CancellationToken token) [0x00042] in <9cab5b8f1b4f49ec980acae8e278968b>:0 at CoCoL.ChannelExtensions.WaitForTaskOrThrow (System.Threading.Tasks.Task task) [0x00050] in <9a758ff4db6c48d6b3d4d0e5c2adf6d1>:0 at Duplicati.Library.Main.Operation.BackupHandler.Run (System.String[] sources, Duplicati.Library.Utility.IFilter filter, System.Threading.CancellationToken token) [0x00009] in <9cab5b8f1b4f49ec980acae8e278968b>:0 at Duplicati.Library.Main.Controller+<>c__DisplayClass14_0.<Backup>b__0 (Duplicati.Library.Main.BackupResults result) [0x0004b] in <9cab5b8f1b4f49ec980acae8e278968b>:0 at Duplicati.Library.Main.Controller.RunAction[T] (T result, System.String[]& paths, Duplicati.Library.Utility.IFilter& filter, System.Action`1[T] method) [0x0026f] in <9cab5b8f1b4f49ec980acae8e278968b>:0 at Duplicati.Library.Main.Controller.Backup (System.String[] inputsources, Duplicati.Library.Utility.IFilter filter) [0x00074] in <9cab5b8f1b4f49ec980acae8e278968b>:0 at Duplicati.CommandLine.Commands.Backup (System.IO.TextWriter outwriter, System.Action`1[T] setup, System.Collections.Generic.List`1[T] args, System.Collections.Generic.Dictionary`2[TKey,TValue] options, Duplicati.Library.Utility.IFilter filter) [0x00119] in <81fea8e154eb4fd9aa8b06aac66d311a>:0 at (wrapper delegate-invoke) System.Func`6[System.IO.TextWriter,System.Action`1[Duplicati.Library.Main.Controller],System.Collections.Generic.List`1[System.String],System.Collections.Generic.Dictionary`2[System.String,System.String],Duplicati.Library.Utility.IFilter,System.Int32].invoke_TResult_T1_T2_T3_T4_T5(System.IO.TextWriter,System.Action`1<Duplicati.Library.Main.Controller>,System.Collections.Generic.List`1<string>,System.Collections.Generic.Dictionary`2<string, string>,Duplicati.Library.Utility.IFilter) at Duplicati.CommandLine.Program.ParseCommandLine (System.IO.TextWriter outwriter, System.Action`1[T] setup, System.Boolean& verboseErrors, System.String[] args) [0x00342] in <81fea8e154eb4fd9aa8b06aac66d311a>:0 at Duplicati.CommandLine.Program.RunCommandLine (System.IO.TextWriter outwriter, System.IO.TextWriter errwriter, System.Action`1[T] setup, System.String[] args) [0x00002] in <81fea8e154eb4fd9aa8b06aac66d311a>:0

Thank you

The one line of log that you are posting don’t show that. It don’t show the contrary either, it’s just that it don’t show much.
Maybe you could open another browser tab on Duplicati, go to live log set at maximum level (verbose level at least), and launch your ‘dummy backup’ in the first tab, and then go back to the live log to see what is displayed ? If it’s not clear, post it here.

What you want to do is not clear either, maybe there is an easier way to do it that could be advised if you gave a broad idea of your objective.

Agreed we need a meaningful error message. The one posted seems to lack its ending (at its top).

If live log doesn’t work (it might only pick up GUI jobs, not so much details on any scripts after), try:

log-file=<path> log-file-log-level=verbose in the script itself, with two dashes in front of the options.

What OS is this? How is GUI started (boot time, login time, other), and as what user are test done?

GUI About → System info will display StartedBy and UserName if you’re not sure of those answers.

Thank you very much for your prompt response. This is what I’m trying to do:
I run a daily rsync incremental backup locally. It generates a daily folder as such:

Once a week I want to push the latest folder to my cloud storage using duplicati. The folder name changes everyday according to the date; therefore I cant pick the source using the duplicati GUI. So I run a script that includes this:

appdatasource=`ls -td -- /source/user/backup/appdata/rsync/* | head -n 1 | cut -d'/' -f7`
# create backup
mono /app/duplicati/Duplicati.CommandLine.exe backup "<destination>" /source/user/backup/appdata/rsync/$appdatasource ......

When I call the bash script from the command line it works fine without error. I was trying to use a dummy backup to use the schedule functionality to run the script.

I’m running duplicati docker (linuxserver image) in Unraid.
If there’s a gui way of doing this, I welcome the advise.

I just run the script adding the --log-file= and --log-file-log-level=verbose options. See attached.
There’s no error and the previous error on the gui disappeared. The script completes and creates the backup (453.7 KB)

So intermittent failure, and we didn’t quite catch a previous issue?
If you like, you can back the log level down to warning for awhile.
That should also catch any error.

Read Example Scripts in the manual, specifically maybe:

Well, what you want to do is clear, but what really happens when your pseudo job runs less so.
Is the log you provide generated by running the script from the command line ? (if it is so, it’s absolutely useless to debug the problem…)

I took the below to imply a GUI run, but thinking a little harder, errors there stick until manually cleared.

Regardless, if there’s still an error in the desired run method, the error needs to be caught and checked.

Thank you for the suggestion.

Im running this

echo "--localpath=/source/user/archive/scripts

But i get this error:

ApplicationName=‘config/scripts/appdata’, CommandLine=‘’, CurrentDirectory=‘’, Native error= Cannot find the specified file

How exactly are you running it, and BTW you have a missing quote if it matters?

What is the significance of /source/user/archive/scripts? It is not Source?

You tell Duplicati the path of the script, and the script updates the Source folder.

the script is config/scripts/appdata
Im running it with --run-script-before-required=config/scripts/appdata
from the appdata backup created in the gui.

/source/user/archive/scripts is the location i want to use. In the docker container the data is mounted under the /source dir

That’s using a path relative to Duplicati’s current directory, and the script probably isn’t there.
LinuxServer’s setup does have you map a /config folder. Is that maybe what you want there?

Thank you for your help. I was indeed missing a “/”
correct path is –run-script-before-required=/config/scripts/appdata
Now the script runs without issue.

Selecting a specific backup on the fly is a common thread.
Im posting my basic script for anyone that may find it useful


# run appdata backup selecting latest source subdirectory                  |

APPD_PATH=`ls -td -- /source/user/backup/appdata/rsync/* | head -n 1`
echo "--localpath=\"$APPD_PATH\""

In the duplicati config folder add a scripts folder and save the above script.

In the GUI in step 5 under advanced options add –run-script-before-required=/config/scripts/appdata

1 Like