I can describe my setup that works very well for a few months now. I’m backing up to SFTP share with key-based authentication.
My duplicacy repository is my home folder /Users/myusername and hence all configuration and other data duplicacy keeps is in ~/.duplicacy/
All other duplicacy related stuff (including SSH keys, launchd daemon, scripts, etc) I also keep there.
My preferences file looks like so:
{
"name": "edited",
"id": "edited",
"storage": "sftp://username@server//Root/Path/to/duplicacy/storage",
"encrypted": true,
"no_backup": false,
"no_restore": false,
"no_save_password": false,
"keys": {
"ssh_key_file": "/Users/myusername/.duplicacy/id_rda_duplicacy"
}
}
]
I have put launchd plist in the same folder and just made a symlink to it under /Library/LaunchDaemons/
The plist looks like so:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.edited.duplicacy</string>
<key>ProgramArguments</key>
<array>
<string>/Users/myusername/.duplicacy/gobackup.sh</string>
</array>
<key>LowPriorityIO</key>
<true/>
<key>WorkingDirectory</key>
<string>/Users/myusername</string>
<key>StandardOutPath</key>
<string>/tmp/duplicacy.stdout</string>
<key>StandardErrorPath</key>
<string>/tmp/duplicacy.stderr</string>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>0</integer>
</dict>
<key>Nice</key>
<integer>-20</integer>
<key>ProcessType</key>
<string>Background</string>
</dict>
</plist>
You can call duplicacy directly by the launchd, but for experimentation I’ve put all relevant code into .sh file under the same .duplciacy storage and call it from there.
It looks like this for me:
#!/bin/bash
cd /Users/myusername
caffeinate -s nice duplicacy backup
# Retention
# After two weeks keep a version every day
# After 90 days keep a version every week
# After one year keep a version every month
caffeinate -s nice duplicacy prune -keep 31:360 -keep 7:90 -keep 1:14
caffeinate -s nice duplicacy prune
Note, you can safely remove “caffeinate” and “nice” from there - but I left it there for occasions when I run that .sh directly.
Another note - duplicacy is so ridiculously fast that caffeinate is not really needed
Third note - stdout and stderr as you can see from the plist are redirected to /tmp/duplicacy.*