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.0.tar.gz (43.3 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.0-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cleanback-1.2.0.tar.gz
  • Upload date:
  • Size: 43.3 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.0.tar.gz
Algorithm Hash digest
SHA256 532ad4e4b748b43450e496ff014e7eeac365bc97ec950fe0047744a11d75f870
MD5 68dda3d5fe61aa690201f15f6185e90b
BLAKE2b-256 0aa305f264b0dc76a8eb96045d33e7b8e2b24e92a201c153eb5c8e008906e6ba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cleanback-1.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 885c2d3566a4303b996514f7720d38ea5aeb1bccc406961ac27c37dc56bee6bf
MD5 a99203528fdf370eb2f2a1b306a5659d
BLAKE2b-256 8194ba96b613c0229117a3f291556cbd4fec8cca644c7e4a4d55cad32dfac850

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