Be the first to know and get exclusive access to offers by signing up for our mailing list(s).

Subscribe

We ❤️ Open Source

A community education resource

How to build automated Linux backups that don’t silently fail

A hands-on tutorial for rsync backups with systemd automation and Healthchecks.io monitoring.

Backup scripts that silently fail are worse than no backups at all. In this video from Learn Linux TV, you’ll learn how to build a production-ready backup system using rsync, systemd timers, and failure monitoring.

Jay walks through creating a Bash script that backs up files with rsync while retaining previous versions in case you need to restore something. The script uses archive mode to preserve metadata, --delete to sync deletions, and --backup-dir to move replaced files into dated directories instead of losing them forever.

The tutorial covers critical production details like mounting NFS shares for remote backups, using --dry-run to test safely before running for real, and implementing a mount point check that prevents the script from writing backups to the local filesystem if your network share drops.

After building the script, Jay creates a systemd service and timer to run backups automatically at midnight. He explains why you enable the timer but leave the service disabled (the timer handles starting it), and demonstrates the Persistent=true option that ensures missed backups run when the system comes back online.

The final piece addresses silent failures. Jay integrates Healthchecks.io by adding a curl call that pings the service only when rsync exits successfully. If the backup doesn’t run or fails, you get an email alert instead of discovering the problem weeks later when you actually need those backups.

Key takeaways

  • Test with dry-run before going live – The --dry-run flag shows exactly what rsync would do without actually copying files, preventing costly mistakes during initial setup.
  • Retain replaced files in dated directories – Using --backup-dir with a timestamp variable preserves old versions whenever files change, giving you version history without manual snapshots.
  • Monitor for silent failures – Integrating monitoring services like Healthchecks.io ensures you know immediately if backups stop working instead of discovering it when disaster strikes.

This hands-on lab delivers a genuinely useful backup system you can run in production. Jay’s approach combines rsync, systemd automation, and failure monitoring into a complete solution that actually works.

More from Learn Linux TV

The opinions expressed on this website are those of each author, not of the author's employer or All Things Open/We Love Open Source.

Want to contribute your open source content?

Contribute to We ❤️ Open Source

Help educate our community by contributing a blog post, tutorial, or how-to.

Two World-class Events

If you didn't make it to All Things AI, check out the event summary, and make plans to join us October 19-20 for All Things Open.

Open Source Meetups

We host some of the most active open source meetups in the U.S. Get more info and RSVP to an upcoming event.