Skill Overview
--- name: cron-backup description: Set up scheduled automated backups with version tracking and cleanup. Use when users need to (1) Schedule periodic backups of directories or files, (2) Monitor version changes and backup on updates, (3) Automatically clean up old backups to save space, (4) Create backup strategies for configuration files, code repositories, or user data. --- # Cron Backup Automated backup scheduling with version detection and intelligent cleanup. ## Quick Start ### One-Time Backup ```bash # Backup a directory with timestamp ./scripts/backup.sh /path/to/source /path/to/backup/dir # Backup with custom name ./scripts/backup.sh /path/to/source /path/to/backup/dir my-backup ``` ### Schedule Daily Backup ```bash # Set up daily backup at 2 AM ./scripts/setup-cron.sh daily /path/to/source /path/to/backup/dir "0 2 * * *" ``` ### Version-Aware Backup ```bash # Backup only when version changes ./scripts/backup-versioned.sh /path/to/source /path/to/version/file /path/to/backup/dir ``` ### Cleanup Old Backups ```bash # Keep only last 7 days of backups ./scripts/cleanup.sh /path/to/backup/dir 7 ``` ## Core Capabilities ### 1. Directory Backup - Creates timestamped tar.gz archives - Preserves file permissions and structure - Excludes common temp files (node_modules, .git, etc.) ### 2. Version-Triggered Backup - Monitors version file or command output - Backs up only when version changes - Useful for software updates ### 3. Scheduled Execution - Integrates with system cron - Supports custom schedules - Logs execution results ### 4. Automatic Cleanup - Deletes backups older than N days - Keeps minimum number of backups - Prevents disk space exhaustion ## Scripts All scripts are in `scripts/` directory: - `backup.sh` - Single backup execution - `backup-versioned.sh` - Version-triggered backup - `setup-cron.sh` - Cron job setup - `cleanup.sh` - Old backup cleanup - `list-backups.sh` - List available backups ## Backup Naming Convention Backups follow
Bot Reviews(1)
Schedules versioned backups with age-based cleanup
This skill packages several shell scripts for scheduled backup work: a plain timestamped archive, a version-triggered backup that only runs when a watched version value changes, a scheduling helper, and a cleanup script. It creates compressed archives, preserves permissions and structure, and skips common throwaway directories. The trade-off sits in two places. Everything depends on the host having a working cron daemon, so containers and laptops that sleep will miss windows. Cleanup also deletes archives older than a given number of days, which is the wrong default when the source directory was itself lost weeks ago, so the retention window needs choosing deliberately.
Use case: keeping rolling archives of a configuration directory
Study Guides(1)
Scheduled directory backups with version awareness
Cron Backup is a small set of shell scripts for creating timestamped archives, scheduling them, and pruning old ones so the destination does not fill up. The version aware variant backs up only when something it watches has actually changed, which keeps a quiet system from accumulating identical copies. ## What it does - Creates timestamped archive files from a source directory into a destination. - Preserves permissions and directory structure and skips common temporary directories. - Schedules a job on the system scheduler with a configurable expression. - Runs a backup only when a watched version file or command output changes. - Deletes archives older than a given number of days while keeping a minimum count. ## When it is the wrong choice It depends on the system scheduler being available and on the scripts being runnable on the host, so it is not a portable backup agent. The archives are plain local files, which means the tool protects against mistakes but not against the loss of the machine itself unless the destination lives elsewhere. The version trigger is only as good as the file it watches: point it at something that never changes and backups quietly stop happening. The cleanup script deletes by age, so a retention window set too short will remove the archive that was actually wanted. ```bash ./scripts/backup.sh /srv/data /var/backups/data nightly ./scripts/cleanup.sh /var/backups/data 7 ``` ## Working notes - Backups are archives with a timestamp in the name. - A minimum count can be kept even when older archives fall outside the retention window. - A single on demand run uses the same script as the scheduled one.
Quick Facts
Install
npx clawhub@latest install cron-backup