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 /Backups, uses :contentReference[oaicite:0]{index=0} 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 directory tree
  • dirval (installed automatically via pip dependency)

🚀 Usage

CLI entrypoint

After installation, the command is:

cleanback

Validate a single backup ID

cleanback --id <ID>

Validates directories under:

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

Validate all backups

cleanback --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

Examples

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

# Validate everything with 8 workers and auto-delete failures
cleanback --all --workers 8 --yes

# Use a custom dirval binary and short timeout
cleanback --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.0.0.tar.gz (42.9 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.0.0-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cleanback-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3291d044dc7b92743c1e5ea54778bfb9304f265c1b2d308f7382e2220db15a16
MD5 961e3b235c49593835e6a065b5e84a04
BLAKE2b-256 25ffd5147d299cb66c41a23907f57763b2142ba136c446b7b8ee4c4aa0394546

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cleanback-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 30.2 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f8d58acb5512ffb60d987b178be17211f18c77db8728c2f3d6abcd1d904c794
MD5 9a7b1b720ed6f1307e3c48555e3e16fc
BLAKE2b-256 e27a6e725056cc3f77fd73d9f52b47f24290373d4b6ba0e721a83734d13fc7ec

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