backup-rotator

Smart backup rotation and retention manager. Create backups, enforce flexible retention policies (grandfather-father-son), verify integrity, and clean up old backups automatically. Use when the user wants to: (1) Create timestamped backups of files or directories, (2) Set up automated backup rotation with retention policies, (3) Keep N daily / M weekly / K monthly backups, (4) Clean up old backup files automatically, (5) Verify backup file integrity with SHA256 checksums, (6) Schedule backup rotation via cron, (7) Audit existing backups in a directory.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "backup-rotator" with this command: npx skills add ericlooi504/backup-rotator

Backup Rotator

Create, rotate, and verify backups with configurable retention policies. Uses only Python standard library — no pip install needed.

Quick start

# Create a backup
python3 skills/backup-rotator/scripts/backup_rotator.py --backup /path/to/source /path/to/backups

# Create backup with compress
python3 skills/backup-rotator/scripts/backup_rotator.py --backup /path/to/dir /backups --compress

# List existing backups
python3 skills/backup-rotator/scripts/backup_rotator.py --list /backups --name myproject

# Rotate (clean old backups)
python3 skills/backup-rotator/scripts/backup_rotator.py --rotate /backups --name myproject

# Dry run (see what would be deleted)
python3 skills/backup-rotator/scripts/backup_rotator.py --rotate /backups --name myproject --dry-run

# Verify backup integrity
python3 skills/backup-rotator/scripts/backup_rotator.py --verify /backups

Retention Policy (default)

CategoryKeepDescription
Daily7Most recent daily backups
Weekly4Most recent Sunday backups
Monthly3First 7 days of each month
Old0Beyond all retention → deleted

Default policy keeps 14 backups minimum.

Config File (for cron)

Create a JSON config file for fully automated backup + rotation:

{
  "backup_source": "/var/lib/postgresql/database.dump",
  "backup_dest": "/backups/db",
  "backup_name": "postgres",
  "keep_daily": 7,
  "keep_weekly": 4,
  "keep_monthly": 3,
  "compress": true,
  "verify": true
}

Then run:

python3 skills/backup-rotator/scripts/backup_rotator.py --cron config.json

Output:

  Backup Rotator — 2026-05-10 13:30:00
  ==================================================
  Name prefix:       postgres
  Keep daily:        7
  Keep weekly:       4
  Keep monthly:      3
  Compress:          yes
  Verify:            yes

  📦 Creating backup...
  Compressing /var/lib/postgresql/database.dump → /backups/db/postgres_20260510-133000.tar.gz
  Size:    42.3M
  SHA256:  a1b2c3d4e5f6...

  🔄 Rotating old backups...
  Summary: 12 keep, 3 delete
  Keeping:
    ✅ postgres_20260510-133000.tar.gz (42.3M) - keep (daily)
    ✅ postgres_20260509-020000.tar.gz (41.8M) - keep (daily)
    ...
  Deleting:
    🗑  postgres_20260428-020000.tar.gz (40.1M) - delete (past retention)

  ✅ Verifying remaining backups...
  ✅ postgres_20260510-133000.tar.gz SHA256: a1b2...
  ✅ postgres_20260509-020000.tar.gz SHA256: b2c3...

Common commands

CommandAction
--backup SOURCE DESTCreate timestamped backup
--list DIRList all backups with age and category
--rotate DIRApply retention policy, delete old backups
--dry-runPreview rotation without deleting
--verify DIRCheck SHA256 checksums of all backups
--cron config.jsonFull automated run: backup + rotate + verify
--name PREFIXFilter backup files by name prefix
--compressCompress directory backups to tar.gz
--no-verifySkip SHA256 verification

Automation with Cron

Add to crontab for daily automated backups:

# Daily at 2am
0 2 * * * cd /home/user && python3 skills/backup-rotator/scripts/backup_rotator.py --cron /home/user/configs/backup-postgres.json >> /var/log/backup-rotator.log 2>&1

Requirements

  • Python 3.6+ (no pip install needed)
  • Uses only standard library: os, shutil, hashlib, json, argparse
  • Works on Linux, macOS (partial)
  • No external API calls — fully offline

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Data Classification

用于数据分类、数据分级、数据分类分级任务。用户要求对单一数据字段名、字段列表、数据库表 SQL/DDL 文件进行数据分类、数据分级或数据分类分级时使用;支持普通数据分类分级、GB/T 43697-2024 通用数据分类分级、金融数据分类分级、JR/T 0197-2020 金融数据安全级别,以及“通用数据标签 +...

Registry SourceRecently Updated
General

Flight Disruption Compensation Kit

Guides air passengers through documenting flight disruptions, checking compensation and duty-of-care eligibility under major regulatory frameworks, and prepa...

Registry SourceRecently Updated
General

Job Offer Evaluation Kit

Compare job offers with structured compensation, benefits, risk, career-fit, and life-fit frameworks. Provides comparison tools only; no financial, tax, lega...

Registry SourceRecently Updated
General

Medical Bill Review Kit

Organizes medical bills and EOBs into a reviewable inventory, provides an error-spotting checklist for common billing mistakes, and prepares structured commu...

Registry SourceRecently Updated