1. First you need to get the binaries for duplicacy and duplicacy-util.
  2. Download the appropriate binary (make sure it’s the right Linux one), e.g. with wget, and then move the files to /usr/local/bin (probably want to rename during this move to get rid of all the extra shit in the downloaded binary filename).
  3. Then run chmod +x to make them executable, and now you’re good to run them like normal programs/commands.
  4. Next step is to initialize duplicacy, so go to the directory you want to backup (you don’t need to go there, you can pass a flag to duplicacy, but this is simpler) and run duplicacy init -e --storage-name SOMENAME BACKUPNAME BACKUPLOCATION. The -e will ask for a password to encrypt the storage, --storage-name differentiates the backend you’re uploading to (you can have multiple), and the rest are self explanatory. At time of writing I’ve been backing up exclusively to Azure since I have free credit there, and the Azure format for duplicacy is azure://storageaccountname/containername. During the init, it will ask for the storage account key as well.
  5. Now you can run a first time backup with duplicacy backup -stats.
  6. Now you’ll want to save the backup password and Azure key so you don’t need to type it in all the time/be able to automate it, and this post details the way to do it. The proper way would be to setup the keyring, but historically I’ve been too lazy and have just been storing the secrets plaintext in the preferences file.
  7. Now it’s time for duplicacy-util, which will help automate this process. In your home directory, run mkdir .duplicacy-util, then inside that folder create the files duplicacy-util.yaml and BACKUPNAME.yaml. In the first file, populate it like so:
notifications:
  onStart: []
  onSkip: ['email']
  onSuccess: ['email']
  onFailure: ['email']

email:
  fromAddress: "Duplicacy Backup <[email protected]>"
  toAddress: "Rudhra Raveendran <[email protected]>"
  serverHostname: smtp.sendgrid.net
  serverPort: 587
  authUsername: apikey
  authPassword: SG.APIKEYHERE
  1. This sets up emailing so we can get reports of backup successes/failures. Now populate the second file like so:
repository: /home

storage:
  - name: azure
    threads: 12

prune:
  - storage: azure
    keep: "0:365 30:180 7:30 1:7"
    threads: 12

check:
  - storage: azure
  1. The storage name here maps to --storage-name from earlier, and repository is the folder where you ran duplicacy init (also where the .duplicacy folder is). Refer to the duplicacy docs on how to interpret the keep entry.
  2. Now all that’s left is adding this line to your crontab: 0 5 * * * /usr/local/bin/duplicacy-util -sd /home/rooday/.duplicacy-util -f BACKUPNAME -a -m -q. This will run the backup every day at 5 AM, and use the yaml file called BACKUPNAME. -a -m -q means run all steps (backup, prune, check), send an email, and be quiet/don’t log info lines. And that’s it!