← Back to all products
$19
Backup Automation
Automated backup scripts for databases, files, and configurations with S3/remote sync.
JSONMarkdownPython
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 9 files
backup-automation/
├── LICENSE
├── README.md
├── examples/
│ └── backup_config.json
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_configuration-reference.md
│ └── 03_license.md
├── index.html
└── src/
└── backup_tool.py
📖 Documentation Preview README excerpt
Backup Automation
Part of the Deploy Kit by CodeVault
Automated backup tool for files and directories with rotation policies, integrity verification, and scheduling configuration. Never lose data because you forgot to set up backups.
Features
- Full and incremental backups: Archive directories to timestamped tar.gz files
- Rotation policies: Keep last N backups, or delete backups older than N days
- Integrity verification: SHA-256 checksums for every backup file
- Restore from backup: Extract any backup to a target directory
- Manifest tracking: JSON manifest of all backups with metadata
- Dry run mode: Preview what would be backed up without creating files
- Size reporting: Track backup sizes over time
- Multiple backup sources in a single config
- Python stdlib only — zero dependencies
Quick Start
# Run a backup using the example config
python src/backup_tool.py backup --config examples/backup_config.json
# Dry run — preview what would be backed up
python src/backup_tool.py backup --config examples/backup_config.json --dry-run
# List all existing backups
python src/backup_tool.py list --config examples/backup_config.json
# Verify backup integrity (check checksums)
python src/backup_tool.py verify --config examples/backup_config.json
# Restore from a specific backup
python src/backup_tool.py restore --config examples/backup_config.json --backup-id 20260314-100000 --target ./restored/
# Apply rotation policy (delete old backups)
python src/backup_tool.py rotate --config examples/backup_config.json
Configuration Reference
| Field | Type | Required | Description |
|---|---|---|---|
backup_name | string | Yes | Name for this backup job |
sources | array | Yes | Directories/files to back up |
destination | string | Yes | Directory to store backups |
rotation | object | No | Rotation policy: keep_count or keep_days |
exclude_patterns | array | No | Glob patterns to exclude (e.g., *.pyc, __pycache__) |
compression | string | No | Compression: gzip (default) or none |
verify_after | bool | No | Verify checksums immediately after backup (default: true) |
CLI Reference
| Command | Description |
|---|---|
backup | Run a backup job |
list | List existing backups |
verify | Verify backup integrity |
restore | Restore from a backup |
... continues with setup instructions, usage examples, and more.
📄 Code Sample .py preview
src/backup_tool.py
#!/usr/bin/env python3
"""
Backup Automation — Deploy Kit by DataNest
Automated backup tool for files and directories with rotation policies,
integrity verification, manifest tracking, and restore capabilities.
Why this exists:
Backups are one of those things everyone knows they should do but
nobody gets around to automating properly. This tool creates
timestamped tar.gz archives, verifies them with SHA-256 checksums,
tracks everything in a JSON manifest, and rotates old backups
automatically. One config file, one command.
Usage:
python backup_tool.py backup --config backup_config.json
python backup_tool.py backup --config backup_config.json --dry-run
python backup_tool.py list --config backup_config.json
python backup_tool.py verify --config backup_config.json
python backup_tool.py restore --config backup_config.json --backup-id 20260314-100000 --target ./restored/
python backup_tool.py rotate --config backup_config.json
License: MIT
"""
from __future__ import annotations
import argparse
import fnmatch
import hashlib
import json
import logging
import os
import shutil
import sys
import tarfile
import time
from dataclasses import dataclass, field
from datetime import datetime, timezone
from pathlib import Path
from typing import Any
# ---------------------------------------------------------------------------
# Constants
# ---------------------------------------------------------------------------
LOG = logging.getLogger("backup-tool")
MANIFEST_FILENAME = "backup_manifest.json"
TIMESTAMP_FORMAT = "%Y%m%d-%H%M%S"
# ... 755 more lines ...