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

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.1.0.tar.gz (43.0 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.1.0-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cleanback-1.1.0.tar.gz
Algorithm Hash digest
SHA256 c58c2409a873b11e967a8410997420ff5764fffd7a71df4dc0df049f6d582160
MD5 a045e527a2a8bd3b97e494dea9b0bd98
BLAKE2b-256 c39c2d1fbd5bbc8acc8a789c06d74621d68c69fc7a4e79a605756bc1288418a0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cleanback-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.3 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da005df28ed621afe97df8d6aa24df636c7360299c6a757f96f3fbbe1cad6a17
MD5 20adaf8d2b1d11a09061dba6d01d2dd1
BLAKE2b-256 82d1728c63a66029927cc0ad0fda505a40725094557fe75d43186f87eaa30054

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