rc-cleanup-bones.sh
Purpose: Backup and prune unneeded directories and templates from bones/
CLI Interface
rc-cleanup-bones.sh [--dry-run] [--verbose] [--help] [--days N]Supported flags:
--help,-hShow usage information and exit.--dry-runPreview actions without making changes.--verboseShow detailed logs.--days NSet retention window in days (default: 30).
Workflow Steps
- Parse Flags & Setup
- Ensure
bones/archive/cleanup-backups/andbones/logs/exist. - Process
--dry-run,--verbose, and--days.
- Ensure
- Backup
- Create a tar.gz of the entire
bones/directory (excluding its own backups folder) intobones/backups/.
- Create a tar.gz of the entire
- Prune Old Backups
- Delete backup archives older than
Ndays.
- Delete backup archives older than
- Prune Logs
- Delete log files in
bones/logs/older thanNdays.
- Delete log files in
- Summary
- Log completion message indicating backup and prune results.
Examples
# Preview cleanup without writing
./bones/scripts/rc-cleanup-bones.sh --dry-run --verbose
# Perform cleanup with a 14-day retention window
./bones/scripts/rc-cleanup-bones.sh --days 14
# Show help
./bones/scripts/rc-cleanup-bones.sh --help