How to use backup json file with duplicati-cli?

Hi,
thanks. im trying not to use the gui to automate things for server user.
Well actually I tried to specify a new sqlite name and it works for the backup.
the restore seems to work better also but I have a problem. here is what happens:
Checking remote backup …
Listing remote folder …
Checking existing target files …
3 files need to be restored (257,68 MB)
Downloading file (99,98 MB) …
0 files need to be restored (0 octets)
Downloading file (99,96 MB) …
Verifying restored files …
Restore completed without errors but no files were restored
Restored 0 (0 octets) files to original path
Duration of restore: 00:01:47
And it throws a bad exit code making my script to crash
Anyway thanks for everything, i will try to investigate in handling the exit codes

What did you do? What did you get? What did you expect? See earlier posts for more such requests.

More vagueness. What is it and why is it bad (aside from bothering your script)? Exit codes should be

$ duplicati-cli help returncodes

Duplicati reports the following return/exit codes:
  0 - Success
  1 - Successful operation, but no files were changed
  2 - Successful operation, but with warnings
  50 - Backup uploaded some files, but did not finish
  100 - An error occurred
  200 - Invalid commandline arguments found

Note there is a forum topic now about 5 below this sharing thoughts on different ways to do exit codes.

What codes does duplicati-cli return?

You didn’t show what you ran, but you might have gotten a 2 due to this previously explained Warning:

I still don’t know what was done or if there was a problem besides an exit code surprise, but I tested with a Remote volume size of 1 MB, and a roughly 40 MB source file which would backup to roughly 40 dblock.

On restore to an empty folder, it downloaded very little (as expected, because the source was still around). Clearing restore-path data again, and adding --no-local-blocks to stop source block grab downloaded:

C:\>"C:\ProgramData\Duplicati\duplicati-2.0.6.104_canary_2022-06-15\Duplicati.CommandLine.exe" restore "file://C:\ProgramData\Duplicati\duplicati-2.0.6.104_canary_2022-06-15\RUN\test 1\\"  --dbpath="C:\ProgramData\Duplicati\duplicati-2.0.6.104_canary_2022-06-15\RUN\MJNTGMLXBD.sqlite" --no-encryption=true --no-local-blocks --restore-path="C:\backup restore" --console-log-level=verbose
Restore started at 1/18/2023 2:24:57 PM
The operation Restore has started
Checking remote backup ...
Backend event: List - Started:  ()
  Listing remote folder ...
Backend event: List - Completed:  (83 bytes)
Searching backup 0 (1/18/2023 7:14:50 PM) ...
Needs to restore 1 files (39.35 MB)
Mapping restore path prefix to "C:\backup source\" to "C:\backup restore\"
Restore list contains 404 blocks with a total size of 39.35 MB
Checking existing target files ...
  1 files need to be restored (39.35 MB)
Target file does not exist: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
41 remote files are required to restore
Backend event: Get - Started: duplicati-bc6eda2be11bd4f7da2f3610a9a5b215c.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-bc6eda2be11bd4f7da2f3610a9a5b215c.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-baa1c5abe87da4a0dbb83f8f2f0259314.dblock.zip (1,002.25 KB)
  Downloading file (1,002.25 KB) ...
Backend event: Get - Completed: duplicati-baa1c5abe87da4a0dbb83f8f2f0259314.dblock.zip (1,002.25 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-b849f6ac7d86f4b3a9014f4bf48be3681.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Recording metadata from remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-b849f6ac7d86f4b3a9014f4bf48be3681.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-b2d7a5ca4d1674f91b1707dac1bbcf4d7.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-b2d7a5ca4d1674f91b1707dac1bbcf4d7.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-b8ca7db3f130441b1aa6e9c8fba64fe63.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-b8ca7db3f130441b1aa6e9c8fba64fe63.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-beb8e955174024b119518c8b9312b1d97.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-beb8e955174024b119518c8b9312b1d97.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-b4ee9fe5af9274bf789eb0c31bb1f737c.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-b4ee9fe5af9274bf789eb0c31bb1f737c.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-b09333d3be6494e4f936cb0f127899d34.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-b09333d3be6494e4f936cb0f127899d34.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-b7ffde8b21058481e9a278600fbc89b65.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-b7ffde8b21058481e9a278600fbc89b65.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-b86585f5e22024c718e629e216fced350.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-b86585f5e22024c718e629e216fced350.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-bedec6159e24940d2ab230a7bf51cd37a.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-bedec6159e24940d2ab230a7bf51cd37a.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-be97b52e1a5064d839246e02711fdfae7.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-be97b52e1a5064d839246e02711fdfae7.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-b2da7ad4406e64570903be39a12ffdbda.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-b2da7ad4406e64570903be39a12ffdbda.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-b6a6ae4add2fc4d1e8c8296a4fcd23b74.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-b6a6ae4add2fc4d1e8c8296a4fcd23b74.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-b18217e173b3f422cad0ce8b1e5f39eb1.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-b18217e173b3f422cad0ce8b1e5f39eb1.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-bdea9556463c242ffac96aa68677f4677.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-bdea9556463c242ffac96aa68677f4677.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-b96569662e6a748e7bec24377629af0e3.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-b96569662e6a748e7bec24377629af0e3.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-b679208671b0a420daf1457744bc17a48.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-b679208671b0a420daf1457744bc17a48.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-b97cc84a21ad54ea78245c80843294576.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-b97cc84a21ad54ea78245c80843294576.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-b4deb986a9b9b429ba4cf3e36bf8fd129.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-b4deb986a9b9b429ba4cf3e36bf8fd129.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-bbd3b16d327e84c36a4dd16479b71d794.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-bbd3b16d327e84c36a4dd16479b71d794.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-ba6948fbf4ab7402ab5c68d0a28dcb770.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-ba6948fbf4ab7402ab5c68d0a28dcb770.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-bf57e61c8d6114e44a8c2ef3dc9079b24.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-bf57e61c8d6114e44a8c2ef3dc9079b24.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-b4d38b1cc84574994be3480c74b459dcf.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-b4d38b1cc84574994be3480c74b459dcf.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-b099d79b3c5f542ddb0dca00afe04f452.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-b099d79b3c5f542ddb0dca00afe04f452.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-b0ccc65afde12455d88723f91f21c6d80.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-b0ccc65afde12455d88723f91f21c6d80.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-b1ecaa316b4994d469bbd3a847ed774d9.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-b1ecaa316b4994d469bbd3a847ed774d9.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-b8b2bfe9cd32e4ce69f7687a8e6cfcea0.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-b8b2bfe9cd32e4ce69f7687a8e6cfcea0.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-b573cb0d0ec5444deaec59c2abe378386.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-b573cb0d0ec5444deaec59c2abe378386.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-b61ee0ec768e74a94a50b707ded7e17d8.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-b61ee0ec768e74a94a50b707ded7e17d8.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-be4978f84b903479aafad3c95e46934f0.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-be4978f84b903479aafad3c95e46934f0.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-bc606d91dc9ae49989527e4d266ba6bd4.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-bc606d91dc9ae49989527e4d266ba6bd4.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-b79fa90d7d6b64f94a7da7237ffca9909.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-b79fa90d7d6b64f94a7da7237ffca9909.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-bc222b2ed765c4675ad4162aa928302b4.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-bc222b2ed765c4675ad4162aa928302b4.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-b9eb6f0f96c0b469aaf04abe00567c030.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Backend event: Get - Completed: duplicati-b9eb6f0f96c0b469aaf04abe00567c030.dblock.zip (1,001.98 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Started: duplicati-bc9c9711ea17441d4a290e93e5b451857.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-bc9c9711ea17441d4a290e93e5b451857.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-be8c33ba32a4b469c9ac3e2d0a40e434e.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-be8c33ba32a4b469c9ac3e2d0a40e434e.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-ba1c1dd5d817249d4893f2e4aa7439a1d.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-ba1c1dd5d817249d4893f2e4aa7439a1d.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-b5afa0cc44fc74013a5cf9b9ac70a7f32.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-b5afa0cc44fc74013a5cf9b9ac70a7f32.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-bbed265df7f8f41899cab90b94e2f15ce.dblock.zip (1,001.98 KB)
  Downloading file (1,001.98 KB) ...
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Backend event: Get - Completed: duplicati-bbed265df7f8f41899cab90b94e2f15ce.dblock.zip (1,001.98 KB)
Backend event: Get - Started: duplicati-b6c0923270f2b40dba270f2d1dc50199e.dblock.zip (310.60 KB)
  Downloading file (310.60 KB) ...
Backend event: Get - Completed: duplicati-b6c0923270f2b40dba270f2d1dc50199e.dblock.zip (310.60 KB)
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Patching file with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Patching metadata with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
  0 files need to be restored (0 bytes)
Verifying restored files ...
Testing restored file integrity: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Restored 1 (39.35 MB) files to C:\backup restore
Duration of restore: 00:00:08
***********************************************
Did we help save your files? If so, please support Duplicati with a donation. We suggest 10? for private use and 100? for commercial use.

https://www.duplicati.com/donate/
***********************************************

but running again did not because the first restore had already set up the --restore-path files correctly.

C:\>"C:\ProgramData\Duplicati\duplicati-2.0.6.104_canary_2022-06-15\Duplicati.CommandLine.exe" restore "file://C:\ProgramData\Duplicati\duplicati-2.0.6.104_canary_2022-06-15\RUN\test 1\\"  --dbpath="C:\ProgramData\Duplicati\duplicati-2.0.6.104_canary_2022-06-15\RUN\MJNTGMLXBD.sqlite" --no-encryption=true --no-local-blocks --restore-path="C:\backup restore" --console-log-level=verbose
Restore started at 1/18/2023 2:25:34 PM
The operation Restore has started
Checking remote backup ...
Backend event: List - Started:  ()
  Listing remote folder ...
Backend event: List - Completed:  (83 bytes)
Searching backup 0 (1/18/2023 7:14:50 PM) ...
Needs to restore 1 files (39.35 MB)
Mapping restore path prefix to "C:\backup source\" to "C:\backup restore\"
Restore list contains 404 blocks with a total size of 39.35 MB
Checking existing target files ...
  1 files need to be restored (39.35 MB)
Target file exists and is correct version: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
1 remote files are required to restore
Backend event: Get - Started: duplicati-baa1c5abe87da4a0dbb83f8f2f0259314.dblock.zip (1,002.25 KB)
  Downloading file (1,002.25 KB) ...
Backend event: Get - Completed: duplicati-baa1c5abe87da4a0dbb83f8f2f0259314.dblock.zip (1,002.25 KB)
Recording metadata from remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
Patching metadata with remote data: C:\backup restore\duplicati-2.0.6.3_beta_2021-06-17.zip
  0 files need to be restored (0 bytes)
Verifying restored files ...
Restore completed without errors but no files were restored
Restored 0 (0 bytes) files to C:\backup restore
Duration of restore: 00:00:01

C:\>echo %ERRORLEVEL%
2

C:\>

I find its forecast of the number of files that need to be restored confusing. It seemingly hadn’t looked at restore-path the first time it forecast. Final forecast is not possible so early. Not sure about second time.

I’m logging at verbose level here because it’s more informative about what’s happening. You can see it finally figure out that Target file exists and is correct version and also be reassured to see a Verifying restored files ... not find any problems. Second run had no restores to do, so exit 2.