I’ve been using Restic for a week or so now, and absolutely love it. Currently I have my (Linux) home directory backed up to a OneDrive repository, which I’ve automated using Cron. Here’s the shell script that Cron runs.
I would like to back up to a second repository on an external storage drive. What’s the best way to do this? And since my backup script runs when I power up my machine, should I lock my home directory beforehand? If so, how?
if your question is about backing up the same folder to multiple/different repositories you can do that by running 2 backup jobs.
Of course it means that you’ll have to create another repository on the external storage you want to use.
something I personally do is setting my restic config as ENV variables and check each time if the remote repository exists or not ( just in case I remove it and forget about it )
# Repo check
if ([ -z "$(restic cat config)" ]) 2>/dev/null;
echo "Repo Initialized"
Thanks, @Sofiane. Is running two backup jobs the preferred method? I’ve read that you can also use restic copy or rclone to sync the second repo with the first. Simply running a second backup job seems much easier.
Your checking that the target repo exists seems like a sensible fail-safe. Thank you!
Do you lock your directory before backing it up, @rawtaz, or do you not find that necessary? Since I back up automatically upon reboot, I find myself tempted to start work before the backup is completed, meaning that (in principle at least) I have files open while it is underway.