restic backups scheduled with native OS tools

4 minute read

Remote Backups - Just Do It

I wanted to share here a project that I did a few years ago but that is still very relevant. What is very relevant? To have off-site client-side encrypted remote backups of course! In the past I used CrashPlan but at some point the switched business model and got rid of the affordable personal plans. As of this I was reviewing the market with some of my requirements being:

  • Client-side encrypted
  • Headless, should be possible to run on a server i.e. CLI
  • Cross-platform
  • Preferably using open source tools
  • Being able to restore to different older revision
  • Retention policy configuration to not explode in storage costs
  • Bonus: flexibility in storage backend

It did not take long time until I came across restic A remote backup CLI program that excels in effectiveness, security, flexibility and portability.
. After playing around for a bit I quickly settled that this tool will be able to do what I want. I also come across Backblaze B2 as a cheap and reliable storage backend that works well with restic.

Problem solved? Not quite.

Automating Backups

There is not built-in scheduler for restic. It’s just a cli tool that you can run like $ restic backup. I started with exploring the simplest solution which on Unix systems will be to use a cron job A Unix tool (standard) for scheduling background jobs.
. While this works, it does not give you the fullest potential if you happen to be running on a system that uses systemd (like mine, Arch Linux). Some benefits would be better access to logging and being able to define dependencies, access control etc.

As I could not find any ready solutions for this on the Internet, I took this as an opportunity to learn more about systemd services and timers. I got it to work very nicely meeting all my initial requirements and the monthly bill is rather low! I shared the results of how I set this up as a template-tutorial on my GitHub. Check it out here:

Dynamic GitHub repo image with stats

I’ve continued to use this setup for several years and it works for me perfectly!

Recently I have worked on this project to include setup for macOS and Windows as wel. For both I use the modern native task scheduler LaunchAgents and ScheduledTask respectivly.

Feel free to contribute like many has already done, directly at the GitHub page with issues or Pull Requests!


No webmentions were found.

Leave a comment

Your email address will not be published. Required fields are marked *