feat: Add comprehensive Plex recovery validation script

- Introduced `validate-plex-recovery.sh` for validating Plex database recovery.
- Implemented checks for service status, database integrity, web interface accessibility, API functionality, and recent logs.
- Added detailed recovery summary and next steps for users.

fix: Improve Debian patching script for compatibility

- Enhanced `debian-patches.sh` to securely download and execute bootstrap scripts.
- Updated package mapping logic and ensured proper permissions for patched files.

fix: Update Docker test scripts for better permission handling

- Modified `run-docker-tests.sh` to set appropriate permissions on logs directory.
- Ensured log files have correct permissions after test runs.

fix: Enhance setup scripts for secure installations

- Updated `setup.sh` to securely download and execute installation scripts for zoxide and nvm.
- Improved error handling for failed downloads.

fix: Refine startup script for log directory permissions

- Adjusted `startup.sh` to set proper permissions for log directories and files.

chore: Revamp update-containers.sh for better error handling and logging

- Rewrote `update-containers.sh` to include detailed logging and error handling.
- Added validation for Docker image names and improved overall script robustness.
This commit is contained in:
Peter Wood
2025-06-05 07:22:28 -04:00
parent 8b514ac0b2
commit 0123fc6007
25 changed files with 4407 additions and 608 deletions

View File

@@ -1,23 +1,43 @@
# Enhanced Plex Backup Script Documentation
This document provides comprehensive documentation for the enhanced `backup-plex.sh` script. This advanced backup solution includes performance monitoring, parallel processing, intelligent notifications, and WAL file handling.
**Author:** Peter Wood <peter@peterwood.dev>
This document provides comprehensive documentation for the enhanced `backup-plex.sh` script. This advanced backup solution includes database integrity checking with automatic repair, performance monitoring, parallel processing, intelligent notifications, and WAL file handling.
## Script Overview
**Author:** Peter Wood <peter@peterwood.dev>
The enhanced script performs the following advanced tasks:
1. **Performance Monitoring**: Tracks backup operations with JSON-based performance logging
2. **Full Backup Operations**: Performs complete backups of all Plex files every time
3. **WAL File Handling**: Properly handles SQLite Write-Ahead Logging files
4. **Database Integrity Verification**: Comprehensive integrity checks with automated repair options
5. **Parallel Processing**: Concurrent verification for improved performance
6. **Multi-Channel Notifications**: Console, webhook, and email notification support
7. **Enhanced Service Management**: Safe Plex service management with progress indicators
8. **Comprehensive Logging**: Detailed logs with color-coded output and timestamps
9. **Safe Automated Cleanup**: Retention policies based on age and backup count
1. **Database Integrity Checking**: Automatic detection and repair of database corruption
2. **Performance Monitoring**: Tracks backup operations with JSON-based performance logging
3. **Full Backup Operations**: Performs complete backups of all Plex files every time
4. **WAL File Handling**: Properly handles SQLite Write-Ahead Logging files
5. **Database Recovery**: Multiple repair strategies from gentle to aggressive
6. **Parallel Processing**: Concurrent verification for improved performance
7. **Multi-Channel Notifications**: Console, webhook, and email notification support
8. **Enhanced Service Management**: Safe Plex service management with progress indicators
9. **Comprehensive Logging**: Detailed logs with color-coded output and timestamps
10. **Safe Automated Cleanup**: Retention policies based on age and backup count
## Enhanced Features
### Database Integrity & Auto-Repair (NEW)
The script now includes comprehensive database integrity checking and automatic repair:
- **What it does**: Checks database integrity before backup and automatically repairs corruption
- **Benefits**:
- Prevents backing up corrupted databases
- Automatically fixes common database issues
- Provides multiple repair strategies
- Comprehensive logging of all repair attempts
- **Usage**:
- `./backup-plex.sh` (auto-repair enabled by default)
- `./backup-plex.sh --disable-auto-repair` (skip auto-repair)
- `./backup-plex.sh --check-integrity` (integrity check only)
### Full Backup Operation
The script performs complete backups every time it runs:
@@ -444,7 +464,7 @@ Backup files follow the naming convention `plex-backup-YYYYMMDD_HHMMSS.tar.gz` f
```text
/mnt/share/media/backups/plex/
├── plex-backup-20250125_143022.tar.gz # Latest backup
├── plex-backup-20250124_143011.tar.gz # Previous backup
├── plex-backup-20250124_143011.tar.gz # Previous backup
├── plex-backup-20250123_143008.tar.gz # Older backup
└── logs/
├── backup_log_20250125_143022.md