Skip to main content

Cleanup Failed Docker Backups — parallel validator (using dirval)

Project description

Cleanup Failed Backups (cleanback) 🚮⚡

GitHub Sponsors Patreon Buy Me a Coffee PayPal

Repository: https://github.com/kevinveenbirkenbach/cleanup-failed-backups

cleanback validates and (optionally) cleans up failed Docker backup directories.
It scans backup folders under a configurable backups root (e.g. /Backups), uses dirval to validate each subdirectory, and lets you delete the ones that fail validation.

Validation runs in parallel for performance; deletions are controlled and can be interactive or fully automatic.


✨ Highlights

  • Parallel validation of backup subdirectories
  • Uses dirval (directory-validator) via CLI
  • Interactive or non-interactive deletion flow (--yes)
  • Supports validating a single backup ID or all backups
  • Clean Python package with pyproject.toml
  • Unit + Docker-based E2E tests

📦 Installation

Via pip (recommended)

pip install cleanback

This installs:

  • the cleanback CLI
  • dirval as a dependency (declared in pyproject.toml)

Editable install (for development)

git clone https://github.com/kevinveenbirkenbach/cleanup-failed-backups
cd cleanup-failed-backups
pip install -e .

🔧 Requirements

  • Python 3.8+
  • Access to the backups root directory tree (e.g. /Backups)
  • dirval (installed automatically via pip dependency)

🚀 Usage

CLI entrypoint

After installation, the command is:

cleanback

Validate a single backup ID

cleanback --backups-root /Backups --id <ID>

Validates directories under:

/Backups/<ID>/backup-docker-to-local/*

Validate all backups

cleanback --backups-root /Backups --all

Scans:

/Backups/*/backup-docker-to-local/*

Common options

Option Description
--dirval-cmd <cmd> Path or name of dirval executable (default: dirval)
--workers <n> Parallel workers (default: CPU count, min 2)
--timeout <sec> Per-directory validation timeout (float supported, default: 300.0)
--yes Non-interactive mode: delete failures automatically
--force-keep <n> In --all mode: skip the last n backup folders (default: 0)

Examples

# Validate a single backup and prompt on failures
cleanback --backups-root /Backups --id 2024-09-01T12-00-00

# Validate everything with 8 workers and auto-delete failures
cleanback --backups-root /Backups --all --workers 8 --yes

# Use a custom dirval binary and short timeout
cleanback --backups-root /Backups --all --dirval-cmd /usr/local/bin/dirval --timeout 5.0

🧪 Tests

Run all tests

make test

🔒 Safety & Design Notes

  • No host filesystem is modified during tests (E2E tests run exclusively inside Docker)
  • Deletions are explicitly confirmed unless --yes is used
  • Timeouts are treated as validation failures
  • Validation and deletion phases are clearly separated

🪪 License

This project is licensed under the GNU Affero General Public License v3.0. See the LICENSE file for details.


👤 Author

Kevin Veen-Birkenbach 🌐 https://www.veen.world 📧 kevin@veen.world

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cleanback-1.2.1.tar.gz (43.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cleanback-1.2.1-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

Details for the file cleanback-1.2.1.tar.gz.

File metadata

  • Download URL: cleanback-1.2.1.tar.gz
  • Upload date:
  • Size: 43.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for cleanback-1.2.1.tar.gz
Algorithm Hash digest
SHA256 f33332b10646c9fea8e92b798d099498eb92e1a1ecb578b2a05d68631b310984
MD5 159f708797afb3e1f8e584194f335305
BLAKE2b-256 272de3523fa1a2d16354758118c8e2945e909c57a9e04e4d2b82830f5f39b685

See more details on using hashes here.

File details

Details for the file cleanback-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: cleanback-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 30.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for cleanback-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 33f31cb02bc0f22a20a6be132944e1a35116671af8301edaf4c1d8d962e468dc
MD5 d6fbfbcad08893fc965c363d90b5fc09
BLAKE2b-256 4964035d1f5a4f58ef49cee7e5bbe9ca8d6dd739b71004cc688189fbde6a35db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page