Description
Design a reliable backup workflow using shell scripts, systemd timers, retention policies, and restore verification.
Objective
Protect important server data with automated backups that can be restored and audited confidently.
Solution
Define the backup policy
- 1Identify critical paths, recovery objectives, retention periods, and encryption needs.
- 2Choose a backup destination separate from the source host.
Automate backups
- 1Create an idempotent shell script with logging and failure handling.
- 2Schedule it with a systemd timer and enforce retention automatically.
- 3
bash
tar -czf /backup/etc-$(date +%F).tar.gz /etc find /backup -type f -mtime +30 -delete
Test recovery
- 1Restore files into an isolated directory and verify checksums.
- 2Run scheduled restore drills and record recovery time.
Tool Stack Used
- π§Bash
- π§Systemd Timers
- π§Tar
- π§Cron