Command line and web UI don't use the same database for a backup

I’m trying to use the command line to delete a single version of a backup. I’m using the command line

/usr/lib/duplicati/Duplicati.CommandLine.exe delete file:///media/jschewe/Schewe_Backup/duplicati_2019-04-29_2 --version=28 --dry-run --no-encryption=true

And receiving the error “Database file does not exist: /root/.config/Duplicati/77849086838283806973.sqlite”.

Looking at the json file exported from the backup job I see “DBPath”: “/root/.config/Duplicati/87738685727877857488.sqlite”

How do I tell the commandline to use the same database file?

The web interface is running as a service.

Of course after I post I find a solution “–dbpath=…”.

Now there still is the question as to why the command line uses a different database name than the webui.

Yeah, Duplicati.CommandLine.exe is completely independent from the web UI. This is a good or bad thing depending on your situation.

If you want a way to interact with the web UI from the command line, such as kicking off a backup job programmatically, there is a better command line utility not included with Duplicati:

I can trigger backup job 1 to run by simply doing this:

duplicati_client.exe login
duplicati_client.exe run 1
duplicati_client.exe logout

Give it a shot…

Pectojin/duplicati-client talks to the server, so should be integrated with things you would do in web GUI.

Integration between command line and web interface #2693

The commandline interface is intentionally separate from the server. The use case is for people who prefer headless commandline tools.

What we need is another tool which sends commands to the running server …

however it looks like what it supports (while useful) is less than everything one might want. If so, maybe:

Using the Command line tools from within the Graphical User Interface is another way to make sure that your many options (including --dbpath) actually get used. “Generally” having irrelevant options won’t hurt.

Export As Command-line is another way to make sure you get the full original options if you like true CLI.

Either way you may need some edits for specific commands.of Using Duplicati from the Command Line .

I started with the command line from inside the web interface and got errors about invalid options. It also wasn’t clear what options were all going to be specified. I could have used the export as command-line and then figured out the options I needed.

The part that I found very frustrating is that the command line assumed one database name and the web ui assumed different database name. I say “assume” here because in neither case did I specify the database path. I would expect that both tools would use the same assumption for the database path or the command line would require the database path so it was clear that it wasn’t going to use the same path that the webui uses.

Wouldn’t that command require --backup-name so it can find the backup to work against?

Maybe, I don’t know. The command line interface doesn’t complain about needing that information to execute. If it’s needed to find the backup, I would have expected to get an error that I need to specify the backup to use, but I don’t. If I specify the database path with “–dbpath” it seems to work.

Creating a new backup job touches on this a bit in one use case, but same is true for any new backup job:

When importing a backup job from a configuration file, a new database will be created, using a random filename.

Database management “Local database path” shows generated name, but file isn’t created until a backup. Although I’m not really familiar with this DB code, I think this is the same case of assigned-but-not-created. Server mapping to DB is in Duplicati-server.sqlite. I knew of dbconfig.json but wasn’t sure of how it’s used. Looking further just now, I think this can maintain mappings for CLI use but (as said) server is independent.

This is the expectation of integrated tools, but they’re independent. Rationale is quoted above. Downside is expectations and frustration of those who don’t know the scheme. Once scheme is set, change is difficult:

I would certainly make a new tool (not add server-control to the current CLI). IMO it would be even more confusing if there is a CLI tool that can work with- and without the server, as it will work differently in the two cases (not write logs, not find database etc).

This messaging might be fixable (I’m not sure how much rearranging it would need). Just stop, then insist Feel free to file an issue asking for more friendly handling of the missing-because-it-was-just-invented DB.

Try using the --backup-name and not the --dbpath and see if it gets the correct database.

I 'm thinking when we work against a backup we always would need either backup-name or dbpath.

No, the command “Duplicati.CommandLine.exe delete” requires the target URL as argument. See Using Duplicati from the Command Line - Duplicati 2 User's Manual

–backup-name is not documented to be used for that, but someone else can look into DatabaseLocator.

A display name that is attached to this backup. Can be used to identify the backup when sending mail or running scripts.