Skip to content
Guest
Cloud & DevOps · Course Syllabus Show lessons
Operations · 8 min read · Intermediate

Automated Database Backups with systemd Timers

Schedule daily online backups, prune old snapshots, and verify restores before you ever need them.

What you'll learn

  • Use SQLite `.backup()` or `pg_dump` for crash-consistent snapshots
  • Retain rolling 14-day backups so disk space never fills up
  • Protect backup files with `chmod 600`

Overview

Schedule daily online backups, prune old snapshots, and verify restores before you ever need them.

Code Example

[Unit]
Description=Daily SQLite Online Backup Timer

[Timer]
OnCalendar=*-*-* 03:00:00
Persistent=true

[Install]
WantedBy=timers.target

Key Takeaways

  • Use SQLite .backup() or pg_dump for crash-consistent snapshots
  • Retain rolling 14-day backups so disk space never fills up
  • Protect backup files with chmod 600

Quick Check

Check Your Understanding

Score: 0 / 1

1. Why is SQLite's online `.backup()` API safer than `cp app.db backup.db` on a live server?

Study Workspace

Finished this lesson?

Your progress is saved locally in your browser, no account needed.

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind