Package: duplicati-client
Duplicati ClientThe Duplicati Client connects to Duplicati servers remotely or locally and helps manage them easily through the command-line.Table of contentsWhy use Duplicati Client?External libraries usedInstallationFrom sourceWindows self contained binaryGNU/Linux and macOS self contained binariesUsageSupported commandsSetting the server passwordParameters fileExport backupsCreate and update backupsWhy use Duplicati Client?Duplicati ships with a CommandLine tool that is capable of doing various actions like backups, restores, and verifying backend data.However, the Duplicati CommandLine is a separate program. It does not communicate with the Duplicati Server that you interact with when using the web UI.This plays out in various ways when trying to manually initiate a backup using the CommandLine tool and the Duplicati server not updating it's metadata or even showing that a backup is happening.Additionally, the CommandLine isstatelessin the sense that you need to provide all the relevant information each time you want to run a command. This can be daunting if you just want to initiate a backup run on an existing backup.The Duplicati Client is a cross platform command-line tool that allows you to interact with the Duplicati Server as if you were using the web UI. It interacts with the same REST API as the web UI, which means it will behave the same and can be used from practically any machine that the web UI can be used from.Furthermore, this tool makes it easy to write custom scripts for use in cron jobs or ad-hoc tasks. You can simply call the Client from your script or cron job as most options can be provided inline by the script. Even if your Duplicati Server is password protected your scripts can easily log in by using a parametersfile.External libraries usedCurrently the script relies on multiple external libraries:requests
PyYaml
python-dateutilInstallationFrom sourceClone the repogit clone https://github.com/pectojin/duplicati-clientThe client runs on Python 3 and requires the above dependenciespip3 install -r requirements.txtFor convenience you can symlink the clientsudo ln -s /location/of/git/repo/duplicati_client.py /usr/bin/ducOn UNIX it should automatically attempt to use Python on your system so now you can just callducAnd you're good to go.Windows self contained binaryFor installation of the Windows self contained binary package I recommend copying it toC:\Program Files\Duplicati Clientand then adding that path to yourenvironment variable pathso that you can callduplicati_clientfrom anywhere in your CLI.GNU/Linux and macOS self contained binariesSelf contained binaries are also available for Linux and macOS.These are useful if you cannot or will not install the 3rd party dependencies on your system, or if you experience compatibility problems with your current Python installation.I recommend copying the binary package to/opt/duplicati_clienton Linux and/Applications/Duplicati Clienton macOS. Then symlink the duplicati_client binarysudo ln -s /location/of/duplicati_client /usr/bin/ducUsageTo begin log into a server:duc login https://my.duplicati.serverThen you can list resourcesduc list backupsGet infoduc get backup 1Run a backup jobduc run backup 1Logout when you're doneduc logoutSupported commandslist      List all resources of a given type
get       display breif information on one or many resources
describe  display detailed information on a specific resource
set       set values on resources
run       run a backup job
abort     abort a task
create    create a resource on the server from a YAMl or JSON file
update    update a resource on the server from a YAMl or JSON file
delete    delete a backup
export    export a backup from the server to YAMl or JSON format
dismiss   dismiss notifications
logs      display the logs for a given job
login     log into a Duplicati server
logout    end the current server session
status    return information about the current session
version   print version number
config    prints the config to stdout
verbose   Change between normal and verbose mode
params    import parameters from a YAML file
pause     pause Duplicati server
resume    resume paused Duplicati serverSome of the commands are placeholders until I get them implemented.Setting the server passwordIt's possible to configure a server password using theset passwordcommand.duc set passwordIt will prompt for the new password and configure it on the server. You can also provide it inline using--passwordor using a parameters file.You can disable the password using--disableduc set password --disableAdditionally, theset passwordcommand will remove thepassword-protectionprompt ("If your machine is in a multi-user environment..."), so if you just want to pre-configure a system to remove that message you can make the--disablecall to remove this message.Parameters fileUsing the commandparamsyou can specify a parameters file. With this file you can provide most of the optional CLI arguments without having to specify them inline when calling your commands.The parameters file is set once using theparamscommand and then automatically loaded on each call.You must create the parameters file yourself. An example of a parameters file:password: verysecretpassword
verbose: TrueThen specify that you want to use a parameters fileduc params ~/.config/duplicati-client/parameters.ymlThis will load your password, set verbose mode, and allow insecure connections by default when you run a command.Loaded 3 parameters from ~/.config/duplicati-client/parameters.ymlThen, if you're connecting to a different server, simply override the default password by adding the--passwordargument in the CLI.duc login localhost --password=othersecretpasswordVerbose is an exception to this rule. It applies session wide and can only be toggled by calling theverbosecommand, which is nonsensical if you have a parameters file enabling it again.If you need to disable your parameters file, runduc params --disableExport backupsThe export command enables building backup configuration files through the CLI. The Duplicati client will pull the necessary information on the selected backup and construct a configuration file. The configuration file can be exported in either YAML or JSON depending on preferenceduc export backup [id]By default the client will export YAML, but you can manually specify either with--output. Additionally you can specify the output path with--output-path. You can also opt to export all backup configs using--all.The resulting file can then be used to create new backup jobs with the import command. Notice that the JSON output is identical to exporting from the Duplicati Web UI, so if you need interoperability use JSON. The YAML file is only understood by this client for now.Default options defined in settings are not exported with the job configuration.Create and update backupsThe Create command allows creating backup jobs from a configuration file. Either a JSON file, as exported from the Duplicati Web UI, or a YAML/JSON file exported from this client. Input files are automatically converted into the JSON format that the Duplicati server requires, so it does not matter which format you import from.duc create backup [path_to_file]By default metadata will not be imported, but if you'd like to retain the metadata use--import-metadataThe Update command allows updating an existing job from a configuration file.duc update backup [backup_id] [path_to_file]Duplicati does not currently allow to update a backup configuration without also overwriting the metadata. If your config file was exported a long time ago with old metadata you may not be interested in this.Apply the--strip-metadataoption to remove the metadata before updating the backup config. This way no metadata will be displayed until the backup job has had a chance to run and provide the correct metadata.Encrypted configuration files are currently not supported.