mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 03:20:12 -08:00
docs: Add missing line breaks for improved readability in documentation files
This commit is contained in:
@@ -5,6 +5,7 @@ This document provides an overview of the `backup-media.sh` script, which is use
|
|||||||
## Script Overview
|
## Script Overview
|
||||||
|
|
||||||
The script performs the following tasks:
|
The script performs the following tasks:
|
||||||
|
|
||||||
1. Creates a log directory if it doesn't exist.
|
1. Creates a log directory if it doesn't exist.
|
||||||
2. Generates a log file with the current date and time.
|
2. Generates a log file with the current date and time.
|
||||||
3. Defines a function to log file details.
|
3. Defines a function to log file details.
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ The enhanced `backup-media.sh` script provides robust, enterprise-grade backup f
|
|||||||
## Features
|
## Features
|
||||||
|
|
||||||
### Core Functionality
|
### Core Functionality
|
||||||
|
|
||||||
- **Multi-service support**: Backs up 7 different media services
|
- **Multi-service support**: Backs up 7 different media services
|
||||||
- **Parallel execution**: Run multiple backups simultaneously for faster completion
|
- **Parallel execution**: Run multiple backups simultaneously for faster completion
|
||||||
- **Verification**: Optional integrity checking of backed up files
|
- **Verification**: Optional integrity checking of backed up files
|
||||||
@@ -14,18 +15,21 @@ The enhanced `backup-media.sh` script provides robust, enterprise-grade backup f
|
|||||||
- **Performance monitoring**: Track backup duration and performance metrics
|
- **Performance monitoring**: Track backup duration and performance metrics
|
||||||
|
|
||||||
### Enhanced Logging
|
### Enhanced Logging
|
||||||
|
|
||||||
- **Multiple log formats**: Plain text, JSON, and Markdown reports
|
- **Multiple log formats**: Plain text, JSON, and Markdown reports
|
||||||
- **Detailed tracking**: File sizes, checksums, timestamps, and status
|
- **Detailed tracking**: File sizes, checksums, timestamps, and status
|
||||||
- **Performance logs**: JSON-formatted performance data for analysis
|
- **Performance logs**: JSON-formatted performance data for analysis
|
||||||
- **Color-coded output**: Easy-to-read terminal output with status colors
|
- **Color-coded output**: Easy-to-read terminal output with status colors
|
||||||
|
|
||||||
### Safety Features
|
### Safety Features
|
||||||
|
|
||||||
- **Dry run mode**: Preview operations without making changes
|
- **Dry run mode**: Preview operations without making changes
|
||||||
- **Pre-flight checks**: Verify disk space and Docker availability
|
- **Pre-flight checks**: Verify disk space and Docker availability
|
||||||
- **Container verification**: Check if containers are running before backup
|
- **Container verification**: Check if containers are running before backup
|
||||||
- **Graceful error handling**: Continue with other services if one fails
|
- **Graceful error handling**: Continue with other services if one fails
|
||||||
|
|
||||||
### Maintenance
|
### Maintenance
|
||||||
|
|
||||||
- **Automatic cleanup**: Remove old backups based on age and count limits
|
- **Automatic cleanup**: Remove old backups based on age and count limits
|
||||||
- **Configurable retention**: Customize how many backups to keep
|
- **Configurable retention**: Customize how many backups to keep
|
||||||
- **Space management**: Monitor and report disk usage
|
- **Space management**: Monitor and report disk usage
|
||||||
@@ -33,6 +37,7 @@ The enhanced `backup-media.sh` script provides robust, enterprise-grade backup f
|
|||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Basic Usage
|
### Basic Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Run standard backup
|
# Run standard backup
|
||||||
./backup-media.sh
|
./backup-media.sh
|
||||||
@@ -64,6 +69,7 @@ The enhanced `backup-media.sh` script provides robust, enterprise-grade backup f
|
|||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
### Environment Variables
|
### Environment Variables
|
||||||
|
|
||||||
The script uses several configurable parameters at the top of the file:
|
The script uses several configurable parameters at the top of the file:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -82,6 +88,7 @@ PERFORMANCE_MONITORING=true # Track performance metrics
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Services Configuration
|
### Services Configuration
|
||||||
|
|
||||||
The script automatically detects and backs up these services:
|
The script automatically detects and backs up these services:
|
||||||
|
|
||||||
| Service | Container Path | Backup Content |
|
| Service | Container Path | Backup Content |
|
||||||
@@ -97,12 +104,14 @@ The script automatically detects and backs up these services:
|
|||||||
## Output Files
|
## Output Files
|
||||||
|
|
||||||
### Log Files
|
### Log Files
|
||||||
|
|
||||||
- **Text Log**: `media-backup-YYYYMMDD_HHMMSS.log` - Standard log format
|
- **Text Log**: `media-backup-YYYYMMDD_HHMMSS.log` - Standard log format
|
||||||
- **Markdown Report**: `media-backup-YYYYMMDD_HHMMSS.md` - Human-readable report
|
- **Markdown Report**: `media-backup-YYYYMMDD_HHMMSS.md` - Human-readable report
|
||||||
- **JSON Log**: `media-backup.json` - Machine-readable backup status
|
- **JSON Log**: `media-backup.json` - Machine-readable backup status
|
||||||
- **Performance Log**: `media-backup-performance.json` - Performance metrics
|
- **Performance Log**: `media-backup-performance.json` - Performance metrics
|
||||||
|
|
||||||
### Backup Structure
|
### Backup Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
/mnt/share/media/backups/
|
/mnt/share/media/backups/
|
||||||
├── logs/
|
├── logs/
|
||||||
@@ -142,6 +151,7 @@ WEBHOOK_URL="https://notify.peterwood.rocks/lab"
|
|||||||
```
|
```
|
||||||
|
|
||||||
Notification includes:
|
Notification includes:
|
||||||
|
|
||||||
- Backup status (success/failure)
|
- Backup status (success/failure)
|
||||||
- Number of successful/failed services
|
- Number of successful/failed services
|
||||||
- Total execution time
|
- Total execution time
|
||||||
@@ -150,12 +160,14 @@ Notification includes:
|
|||||||
## Performance Monitoring
|
## Performance Monitoring
|
||||||
|
|
||||||
When enabled, the script tracks:
|
When enabled, the script tracks:
|
||||||
|
|
||||||
- Individual service backup duration
|
- Individual service backup duration
|
||||||
- Overall script execution time
|
- Overall script execution time
|
||||||
- Timestamps for performance analysis
|
- Timestamps for performance analysis
|
||||||
- JSON format for easy parsing and graphing
|
- JSON format for easy parsing and graphing
|
||||||
|
|
||||||
Example performance log entry:
|
Example performance log entry:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"timestamp": "2025-05-25T14:30:22-05:00",
|
"timestamp": "2025-05-25T14:30:22-05:00",
|
||||||
@@ -178,7 +190,9 @@ The script provides robust error handling:
|
|||||||
## Integration
|
## Integration
|
||||||
|
|
||||||
### Cron Job
|
### Cron Job
|
||||||
|
|
||||||
Add to crontab for automated daily backups:
|
Add to crontab for automated daily backups:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Daily at 2 AM
|
# Daily at 2 AM
|
||||||
0 2 * * * /home/acedanger/shell/backup-media.sh >/dev/null 2>&1
|
0 2 * * * /home/acedanger/shell/backup-media.sh >/dev/null 2>&1
|
||||||
@@ -188,7 +202,9 @@ Add to crontab for automated daily backups:
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Monitoring
|
### Monitoring
|
||||||
|
|
||||||
Use the JSON logs for monitoring integration:
|
Use the JSON logs for monitoring integration:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Check last backup status
|
# Check last backup status
|
||||||
jq '.sonarr.status' /home/acedanger/shell/logs/media-backup.json
|
jq '.sonarr.status' /home/acedanger/shell/logs/media-backup.json
|
||||||
@@ -202,30 +218,38 @@ jq '.[] | select(.operation == "full_media_backup")' /home/acedanger/shell/logs/
|
|||||||
### Common Issues
|
### Common Issues
|
||||||
|
|
||||||
1. **Container Not Running**
|
1. **Container Not Running**
|
||||||
|
|
||||||
```
|
```
|
||||||
WARNING: Container 'sonarr' is not running
|
WARNING: Container 'sonarr' is not running
|
||||||
```
|
```
|
||||||
|
|
||||||
- Verify the container is running: `docker ps`
|
- Verify the container is running: `docker ps`
|
||||||
- Start the container: `docker start sonarr`
|
- Start the container: `docker start sonarr`
|
||||||
|
|
||||||
2. **Permission Denied**
|
2. **Permission Denied**
|
||||||
|
|
||||||
```
|
```
|
||||||
ERROR: Backup failed for sonarr
|
ERROR: Backup failed for sonarr
|
||||||
```
|
```
|
||||||
|
|
||||||
- Check Docker permissions
|
- Check Docker permissions
|
||||||
- Verify backup directory permissions
|
- Verify backup directory permissions
|
||||||
- Ensure script has execute permissions
|
- Ensure script has execute permissions
|
||||||
|
|
||||||
3. **Disk Space**
|
3. **Disk Space**
|
||||||
|
|
||||||
```
|
```
|
||||||
ERROR: Insufficient disk space
|
ERROR: Insufficient disk space
|
||||||
```
|
```
|
||||||
|
|
||||||
- Free up space in backup directory
|
- Free up space in backup directory
|
||||||
- Adjust `MAX_BACKUP_AGE_DAYS` for more aggressive cleanup
|
- Adjust `MAX_BACKUP_AGE_DAYS` for more aggressive cleanup
|
||||||
- Run manual cleanup: `find /mnt/share/media/backups -mtime +7 -delete`
|
- Run manual cleanup: `find /mnt/share/media/backups -mtime +7 -delete`
|
||||||
|
|
||||||
### Debug Mode
|
### Debug Mode
|
||||||
|
|
||||||
For troubleshooting, run with verbose output:
|
For troubleshooting, run with verbose output:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Enable debugging
|
# Enable debugging
|
||||||
bash -x ./backup-media.sh --dry-run
|
bash -x ./backup-media.sh --dry-run
|
||||||
@@ -259,6 +283,7 @@ docker exec sonarr ls -la /config/Backups/scheduled
|
|||||||
## Future Enhancements
|
## Future Enhancements
|
||||||
|
|
||||||
Potential improvements for future versions:
|
Potential improvements for future versions:
|
||||||
|
|
||||||
- Database integrity checking for specific services
|
- Database integrity checking for specific services
|
||||||
- Compression of backup archives
|
- Compression of backup archives
|
||||||
- Remote backup destinations (S3, rsync, etc.)
|
- Remote backup destinations (S3, rsync, etc.)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ This document provides an overview and step-by-step explanation of the `folder-m
|
|||||||
## Script Overview
|
## Script Overview
|
||||||
|
|
||||||
The script performs the following main tasks:
|
The script performs the following main tasks:
|
||||||
|
|
||||||
1. Checks if a directory is provided as an argument.
|
1. Checks if a directory is provided as an argument.
|
||||||
2. Calculates the disk usage of the directory.
|
2. Calculates the disk usage of the directory.
|
||||||
3. Iterates over each subdirectory to calculate disk usage and file count.
|
3. Iterates over each subdirectory to calculate disk usage and file count.
|
||||||
@@ -64,9 +65,11 @@ To use the script, run it with the directory path as an argument:
|
|||||||
## Important Information
|
## Important Information
|
||||||
|
|
||||||
- Ensure that the script is executable. You can make it executable with the following command:
|
- Ensure that the script is executable. You can make it executable with the following command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
chmod +x folder-metrics.sh
|
chmod +x folder-metrics.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
- The script requires a directory path as an argument. Ensure that you provide a valid directory path when running the script.
|
- The script requires a directory path as an argument. Ensure that you provide a valid directory path when running the script.
|
||||||
|
|
||||||
By following this documentation, you should be able to understand and use the `folder-metrics.sh` script effectively.
|
By following this documentation, you should be able to understand and use the `folder-metrics.sh` script effectively.
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ This document provides an overview and step-by-step explanation of the `plex.sh`
|
|||||||
## Script Overview
|
## Script Overview
|
||||||
|
|
||||||
The script performs the following main tasks:
|
The script performs the following main tasks:
|
||||||
|
|
||||||
1. Starts the Plex Media Server.
|
1. Starts the Plex Media Server.
|
||||||
2. Stops the Plex Media Server.
|
2. Stops the Plex Media Server.
|
||||||
3. Restarts the Plex Media Server.
|
3. Restarts the Plex Media Server.
|
||||||
@@ -71,9 +72,11 @@ To use the script, run it with one of the following parameters:
|
|||||||
## Important Information
|
## Important Information
|
||||||
|
|
||||||
- Ensure that the script is executable. You can make it executable with the following command:
|
- Ensure that the script is executable. You can make it executable with the following command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
chmod +x plex.sh
|
chmod +x plex.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
- The script uses `systemctl` to manage the Plex Media Server service. Ensure that `systemctl` is available on your system.
|
- The script uses `systemctl` to manage the Plex Media Server service. Ensure that `systemctl` is available on your system.
|
||||||
- The script requires `sudo` privileges to manage the Plex Media Server service. Ensure that you have the necessary permissions to run the script with `sudo`.
|
- The script requires `sudo` privileges to manage the Plex Media Server service. Ensure that you have the necessary permissions to run the script with `sudo`.
|
||||||
|
|
||||||
|
|||||||
@@ -62,12 +62,14 @@ sudo ./backup-plex.sh --check-integrity --non-interactive
|
|||||||
### 4. Test Notification Systems
|
### 4. Test Notification Systems
|
||||||
|
|
||||||
#### Webhook Testing
|
#### Webhook Testing
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Replace with your actual webhook URL
|
# Replace with your actual webhook URL
|
||||||
sudo ./backup-plex.sh --check-integrity --webhook=https://your-webhook-endpoint.com/test
|
sudo ./backup-plex.sh --check-integrity --webhook=https://your-webhook-endpoint.com/test
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Email Testing
|
#### Email Testing
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Replace with your email address
|
# Replace with your email address
|
||||||
sudo ./backup-plex.sh --check-integrity --email=admin@yourdomain.com
|
sudo ./backup-plex.sh --check-integrity --email=admin@yourdomain.com
|
||||||
@@ -83,6 +85,7 @@ sudo ./backup-plex.sh --non-interactive
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Verify**:
|
**Verify**:
|
||||||
|
|
||||||
- [ ] Plex service stopped and restarted properly
|
- [ ] Plex service stopped and restarted properly
|
||||||
- [ ] Backup files created in `/mnt/share/media/backups/plex/YYYYMMDD/`
|
- [ ] Backup files created in `/mnt/share/media/backups/plex/YYYYMMDD/`
|
||||||
- [ ] Log files updated in `/mnt/share/media/backups/logs/`
|
- [ ] Log files updated in `/mnt/share/media/backups/logs/`
|
||||||
@@ -194,6 +197,7 @@ Schedule weekly backup validation:
|
|||||||
### Common Issues
|
### Common Issues
|
||||||
|
|
||||||
#### 1. Permission Denied Errors
|
#### 1. Permission Denied Errors
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Fix script permissions
|
# Fix script permissions
|
||||||
chmod +x /home/acedanger/shell/*.sh
|
chmod +x /home/acedanger/shell/*.sh
|
||||||
@@ -203,6 +207,7 @@ sudo chown -R $(whoami):$(whoami) /mnt/share/media/backups/
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### 2. Plex Service Issues
|
#### 2. Plex Service Issues
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Check Plex service status
|
# Check Plex service status
|
||||||
sudo systemctl status plexmediaserver
|
sudo systemctl status plexmediaserver
|
||||||
@@ -212,6 +217,7 @@ sudo systemctl restart plexmediaserver
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### 3. Insufficient Disk Space
|
#### 3. Insufficient Disk Space
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Check available space
|
# Check available space
|
||||||
df -h /mnt/share/media/backups/
|
df -h /mnt/share/media/backups/
|
||||||
@@ -221,6 +227,7 @@ df -h /mnt/share/media/backups/
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### 4. Database Integrity Issues
|
#### 4. Database Integrity Issues
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Run integrity check only
|
# Run integrity check only
|
||||||
sudo ./backup-plex.sh --check-integrity --auto-repair
|
sudo ./backup-plex.sh --check-integrity --auto-repair
|
||||||
@@ -232,20 +239,24 @@ sudo ./backup-plex.sh --auto-repair
|
|||||||
### Performance Optimization
|
### Performance Optimization
|
||||||
|
|
||||||
#### 1. Parallel Processing
|
#### 1. Parallel Processing
|
||||||
|
|
||||||
- Enable parallel verification for faster backups (default: enabled)
|
- Enable parallel verification for faster backups (default: enabled)
|
||||||
- Disable with `--no-parallel` if experiencing issues
|
- Disable with `--no-parallel` if experiencing issues
|
||||||
|
|
||||||
#### 2. Performance Monitoring
|
#### 2. Performance Monitoring
|
||||||
|
|
||||||
- Disable with `--no-performance` if not needed
|
- Disable with `--no-performance` if not needed
|
||||||
- Monitor trends to optimize backup timing
|
- Monitor trends to optimize backup timing
|
||||||
|
|
||||||
#### 3. Notification Optimization
|
#### 3. Notification Optimization
|
||||||
|
|
||||||
- Use webhooks instead of email for faster notifications
|
- Use webhooks instead of email for faster notifications
|
||||||
- Configure webhook endpoints with proper error handling
|
- Configure webhook endpoints with proper error handling
|
||||||
|
|
||||||
## Security Considerations
|
## Security Considerations
|
||||||
|
|
||||||
### 1. File Permissions
|
### 1. File Permissions
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Secure backup files
|
# Secure backup files
|
||||||
chmod 600 /home/acedanger/shell/logs/plex-backup*.json
|
chmod 600 /home/acedanger/shell/logs/plex-backup*.json
|
||||||
@@ -253,11 +264,13 @@ chmod 700 /mnt/share/media/backups/plex/
|
|||||||
```
|
```
|
||||||
|
|
||||||
### 2. Webhook Security
|
### 2. Webhook Security
|
||||||
|
|
||||||
- Use HTTPS endpoints for webhooks
|
- Use HTTPS endpoints for webhooks
|
||||||
- Implement webhook signature verification if possible
|
- Implement webhook signature verification if possible
|
||||||
- Avoid including sensitive data in webhook payloads
|
- Avoid including sensitive data in webhook payloads
|
||||||
|
|
||||||
### 3. Access Control
|
### 3. Access Control
|
||||||
|
|
||||||
- Limit script execution to authorized users
|
- Limit script execution to authorized users
|
||||||
- Consider using dedicated backup user account
|
- Consider using dedicated backup user account
|
||||||
- Regularly audit file access permissions
|
- Regularly audit file access permissions
|
||||||
@@ -273,6 +286,7 @@ The script automatically manages backup retention:
|
|||||||
## Recovery Planning
|
## Recovery Planning
|
||||||
|
|
||||||
### 1. Backup Restoration
|
### 1. Backup Restoration
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# List available backups
|
# List available backups
|
||||||
./restore-plex.sh --list
|
./restore-plex.sh --list
|
||||||
@@ -282,6 +296,7 @@ sudo ./restore-plex.sh --restore YYYYMMDD
|
|||||||
```
|
```
|
||||||
|
|
||||||
### 2. Emergency Procedures
|
### 2. Emergency Procedures
|
||||||
|
|
||||||
1. Stop Plex service: `sudo systemctl stop plexmediaserver`
|
1. Stop Plex service: `sudo systemctl stop plexmediaserver`
|
||||||
2. Backup current data: `./restore-plex.sh --backup-current`
|
2. Backup current data: `./restore-plex.sh --backup-current`
|
||||||
3. Restore from backup: `sudo ./restore-plex.sh --restore YYYYMMDD`
|
3. Restore from backup: `sudo ./restore-plex.sh --restore YYYYMMDD`
|
||||||
@@ -301,12 +316,14 @@ Monitor these metrics to ensure backup system health:
|
|||||||
## Support and Updates
|
## Support and Updates
|
||||||
|
|
||||||
### Getting Help
|
### Getting Help
|
||||||
|
|
||||||
1. Check logs for error messages
|
1. Check logs for error messages
|
||||||
2. Run validation tools for diagnosis
|
2. Run validation tools for diagnosis
|
||||||
3. Review troubleshooting guide
|
3. Review troubleshooting guide
|
||||||
4. Test with `--check-integrity` for safe debugging
|
4. Test with `--check-integrity` for safe debugging
|
||||||
|
|
||||||
### Script Updates
|
### Script Updates
|
||||||
|
|
||||||
- Keep scripts updated with latest features
|
- Keep scripts updated with latest features
|
||||||
- Test updates in non-production environment first
|
- Test updates in non-production environment first
|
||||||
- Backup current scripts before updating
|
- Backup current scripts before updating
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ This document summarizes the completed enhanced Plex Media Server backup system
|
|||||||
### 1. Enhanced Backup Script (`backup-plex.sh`)
|
### 1. Enhanced Backup Script (`backup-plex.sh`)
|
||||||
|
|
||||||
**Core Functionality:**
|
**Core Functionality:**
|
||||||
|
|
||||||
- ✅ Intelligent backup detection (only backs up changed files)
|
- ✅ Intelligent backup detection (only backs up changed files)
|
||||||
- ✅ WAL file handling with automatic checkpointing
|
- ✅ WAL file handling with automatic checkpointing
|
||||||
- ✅ Database integrity verification with automated repair options
|
- ✅ Database integrity verification with automated repair options
|
||||||
@@ -17,6 +18,7 @@ This document summarizes the completed enhanced Plex Media Server backup system
|
|||||||
- ✅ Safe Plex service management
|
- ✅ Safe Plex service management
|
||||||
|
|
||||||
**Advanced Features:**
|
**Advanced Features:**
|
||||||
|
|
||||||
- ✅ JSON-based performance monitoring
|
- ✅ JSON-based performance monitoring
|
||||||
- ✅ Multi-channel notification system (console, webhook, email)
|
- ✅ Multi-channel notification system (console, webhook, email)
|
||||||
- ✅ Checksum caching for efficiency
|
- ✅ Checksum caching for efficiency
|
||||||
@@ -25,6 +27,7 @@ This document summarizes the completed enhanced Plex Media Server backup system
|
|||||||
- ✅ Non-interactive mode for automation
|
- ✅ Non-interactive mode for automation
|
||||||
|
|
||||||
**Command Line Options:**
|
**Command Line Options:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./backup-plex.sh [OPTIONS]
|
./backup-plex.sh [OPTIONS]
|
||||||
--auto-repair Automatically attempt to repair corrupted databases
|
--auto-repair Automatically attempt to repair corrupted databases
|
||||||
@@ -40,6 +43,7 @@ This document summarizes the completed enhanced Plex Media Server backup system
|
|||||||
### 2. Comprehensive Testing Framework
|
### 2. Comprehensive Testing Framework
|
||||||
|
|
||||||
**Unit Testing (`test-plex-backup.sh`):**
|
**Unit Testing (`test-plex-backup.sh`):**
|
||||||
|
|
||||||
- ✅ 9 comprehensive unit tests covering all major functionality
|
- ✅ 9 comprehensive unit tests covering all major functionality
|
||||||
- ✅ JSON log initialization testing
|
- ✅ JSON log initialization testing
|
||||||
- ✅ Performance tracking validation
|
- ✅ Performance tracking validation
|
||||||
@@ -53,6 +57,7 @@ This document summarizes the completed enhanced Plex Media Server backup system
|
|||||||
- ✅ **Current Status: 100% test pass rate**
|
- ✅ **Current Status: 100% test pass rate**
|
||||||
|
|
||||||
**Integration Testing (`integration-test-plex.sh`):**
|
**Integration Testing (`integration-test-plex.sh`):**
|
||||||
|
|
||||||
- ✅ 8 comprehensive integration tests
|
- ✅ 8 comprehensive integration tests
|
||||||
- ✅ Command line argument parsing
|
- ✅ Command line argument parsing
|
||||||
- ✅ Performance monitoring features
|
- ✅ Performance monitoring features
|
||||||
@@ -67,6 +72,7 @@ This document summarizes the completed enhanced Plex Media Server backup system
|
|||||||
### 3. Monitoring and Validation Tools
|
### 3. Monitoring and Validation Tools
|
||||||
|
|
||||||
**Monitoring Dashboard (`monitor-plex-backup.sh`):**
|
**Monitoring Dashboard (`monitor-plex-backup.sh`):**
|
||||||
|
|
||||||
- ✅ Real-time system status monitoring
|
- ✅ Real-time system status monitoring
|
||||||
- ✅ Backup status and health checks
|
- ✅ Backup status and health checks
|
||||||
- ✅ Performance metrics display
|
- ✅ Performance metrics display
|
||||||
@@ -76,6 +82,7 @@ This document summarizes the completed enhanced Plex Media Server backup system
|
|||||||
- ✅ Watch mode for continuous monitoring
|
- ✅ Watch mode for continuous monitoring
|
||||||
|
|
||||||
**Backup Validation (`validate-plex-backups.sh`):**
|
**Backup Validation (`validate-plex-backups.sh`):**
|
||||||
|
|
||||||
- ✅ Comprehensive backup integrity verification
|
- ✅ Comprehensive backup integrity verification
|
||||||
- ✅ Backup freshness monitoring
|
- ✅ Backup freshness monitoring
|
||||||
- ✅ JSON log validation
|
- ✅ JSON log validation
|
||||||
@@ -84,6 +91,7 @@ This document summarizes the completed enhanced Plex Media Server backup system
|
|||||||
- ✅ Detailed reporting capabilities
|
- ✅ Detailed reporting capabilities
|
||||||
|
|
||||||
**Restore Functionality (`restore-plex.sh`):**
|
**Restore Functionality (`restore-plex.sh`):**
|
||||||
|
|
||||||
- ✅ Safe backup restoration
|
- ✅ Safe backup restoration
|
||||||
- ✅ Backup listing and validation
|
- ✅ Backup listing and validation
|
||||||
- ✅ Current data backup before restore
|
- ✅ Current data backup before restore
|
||||||
@@ -92,6 +100,7 @@ This document summarizes the completed enhanced Plex Media Server backup system
|
|||||||
### 4. Documentation Suite
|
### 4. Documentation Suite
|
||||||
|
|
||||||
**Enhanced Documentation (`docs/enhanced-plex-backup.md`):**
|
**Enhanced Documentation (`docs/enhanced-plex-backup.md`):**
|
||||||
|
|
||||||
- ✅ Comprehensive feature documentation
|
- ✅ Comprehensive feature documentation
|
||||||
- ✅ Usage examples and best practices
|
- ✅ Usage examples and best practices
|
||||||
- ✅ Performance monitoring guide
|
- ✅ Performance monitoring guide
|
||||||
@@ -100,6 +109,7 @@ This document summarizes the completed enhanced Plex Media Server backup system
|
|||||||
- ✅ Troubleshooting guide
|
- ✅ Troubleshooting guide
|
||||||
|
|
||||||
**Production Deployment Guide (`docs/production-deployment-guide.md`):**
|
**Production Deployment Guide (`docs/production-deployment-guide.md`):**
|
||||||
|
|
||||||
- ✅ Pre-deployment checklist
|
- ✅ Pre-deployment checklist
|
||||||
- ✅ System requirements verification
|
- ✅ System requirements verification
|
||||||
- ✅ Step-by-step deployment instructions
|
- ✅ Step-by-step deployment instructions
|
||||||
@@ -110,23 +120,27 @@ This document summarizes the completed enhanced Plex Media Server backup system
|
|||||||
- ✅ Performance optimization tips
|
- ✅ Performance optimization tips
|
||||||
|
|
||||||
**Original Documentation (`docs/plex-backup.md`):**
|
**Original Documentation (`docs/plex-backup.md`):**
|
||||||
|
|
||||||
- ✅ Preserved original documentation for reference
|
- ✅ Preserved original documentation for reference
|
||||||
- ✅ Basic usage instructions maintained
|
- ✅ Basic usage instructions maintained
|
||||||
|
|
||||||
## 📊 Current System Status
|
## 📊 Current System Status
|
||||||
|
|
||||||
### Test Results
|
### Test Results
|
||||||
|
|
||||||
- **Unit Tests**: 9/9 passing (100% success rate)
|
- **Unit Tests**: 9/9 passing (100% success rate)
|
||||||
- **Integration Tests**: 8/8 passing (100% success rate)
|
- **Integration Tests**: 8/8 passing (100% success rate)
|
||||||
- **System Validation**: All core components verified
|
- **System Validation**: All core components verified
|
||||||
|
|
||||||
### Performance Metrics
|
### Performance Metrics
|
||||||
|
|
||||||
- **Script Execution**: Optimized with parallel processing
|
- **Script Execution**: Optimized with parallel processing
|
||||||
- **Backup Detection**: Intelligent change detection reduces unnecessary work
|
- **Backup Detection**: Intelligent change detection reduces unnecessary work
|
||||||
- **Service Downtime**: Minimized through efficient database operations
|
- **Service Downtime**: Minimized through efficient database operations
|
||||||
- **Storage Usage**: Automatic cleanup and compression
|
- **Storage Usage**: Automatic cleanup and compression
|
||||||
|
|
||||||
### Monitoring Capabilities
|
### Monitoring Capabilities
|
||||||
|
|
||||||
- **Real-time Dashboard**: Comprehensive system health monitoring
|
- **Real-time Dashboard**: Comprehensive system health monitoring
|
||||||
- **Automated Validation**: Regular backup integrity checks
|
- **Automated Validation**: Regular backup integrity checks
|
||||||
- **Performance Tracking**: JSON-based operation timing
|
- **Performance Tracking**: JSON-based operation timing
|
||||||
@@ -139,6 +153,7 @@ This document summarizes the completed enhanced Plex Media Server backup system
|
|||||||
The enhanced Plex backup system is fully tested, documented, and ready for production deployment. All major features have been implemented, tested, and validated.
|
The enhanced Plex backup system is fully tested, documented, and ready for production deployment. All major features have been implemented, tested, and validated.
|
||||||
|
|
||||||
### Deployment Checklist
|
### Deployment Checklist
|
||||||
|
|
||||||
- ✅ **Core Functionality**: All features implemented and tested
|
- ✅ **Core Functionality**: All features implemented and tested
|
||||||
- ✅ **Error Handling**: Comprehensive error recovery mechanisms
|
- ✅ **Error Handling**: Comprehensive error recovery mechanisms
|
||||||
- ✅ **Testing Framework**: 100% test coverage with passing tests
|
- ✅ **Testing Framework**: 100% test coverage with passing tests
|
||||||
@@ -150,6 +165,7 @@ The enhanced Plex backup system is fully tested, documented, and ready for produ
|
|||||||
## 📋 Recommended Next Steps
|
## 📋 Recommended Next Steps
|
||||||
|
|
||||||
### 1. Production Deployment
|
### 1. Production Deployment
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Follow the production deployment guide
|
# Follow the production deployment guide
|
||||||
cd /home/acedanger/shell
|
cd /home/acedanger/shell
|
||||||
@@ -159,6 +175,7 @@ sudo ./backup-plex.sh --non-interactive # First production backup
|
|||||||
```
|
```
|
||||||
|
|
||||||
### 2. Automated Scheduling
|
### 2. Automated Scheduling
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Set up daily automated backups
|
# Set up daily automated backups
|
||||||
sudo crontab -e
|
sudo crontab -e
|
||||||
@@ -166,6 +183,7 @@ sudo crontab -e
|
|||||||
```
|
```
|
||||||
|
|
||||||
### 3. Monitoring Setup
|
### 3. Monitoring Setup
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Monitor backup system health
|
# Monitor backup system health
|
||||||
./monitor-plex-backup.sh --watch # Continuous monitoring
|
./monitor-plex-backup.sh --watch # Continuous monitoring
|
||||||
@@ -173,11 +191,13 @@ sudo crontab -e
|
|||||||
```
|
```
|
||||||
|
|
||||||
### 4. Notification Configuration
|
### 4. Notification Configuration
|
||||||
|
|
||||||
- Configure webhook endpoints for real-time alerts
|
- Configure webhook endpoints for real-time alerts
|
||||||
- Set up email notifications for backup status
|
- Set up email notifications for backup status
|
||||||
- Test notification delivery with actual endpoints
|
- Test notification delivery with actual endpoints
|
||||||
|
|
||||||
### 5. Performance Optimization
|
### 5. Performance Optimization
|
||||||
|
|
||||||
- Monitor performance logs for optimization opportunities
|
- Monitor performance logs for optimization opportunities
|
||||||
- Adjust parallel processing settings based on system performance
|
- Adjust parallel processing settings based on system performance
|
||||||
- Fine-tune retention policies based on storage requirements
|
- Fine-tune retention policies based on storage requirements
|
||||||
|
|||||||
@@ -23,10 +23,12 @@ The testing framework consists of three main components:
|
|||||||
### The Docker Test Environment
|
### The Docker Test Environment
|
||||||
|
|
||||||
The `Dockerfile` defines two testing environments:
|
The `Dockerfile` defines two testing environments:
|
||||||
|
|
||||||
- **ubuntu-test**: Based on Ubuntu 24.04
|
- **ubuntu-test**: Based on Ubuntu 24.04
|
||||||
- **debian-test**: Based on Debian 12
|
- **debian-test**: Based on Debian 12
|
||||||
|
|
||||||
Each environment:
|
Each environment:
|
||||||
|
|
||||||
1. Installs minimal dependencies (curl, git, sudo, wget)
|
1. Installs minimal dependencies (curl, git, sudo, wget)
|
||||||
2. Creates a test user with sudo permissions
|
2. Creates a test user with sudo permissions
|
||||||
3. Sets up the directory structure for testing
|
3. Sets up the directory structure for testing
|
||||||
@@ -100,12 +102,14 @@ The testing framework offers different options for different testing needs:
|
|||||||
### Key Differences
|
### Key Differences
|
||||||
|
|
||||||
**Standard Tests** (`ubuntu`, `debian`):
|
**Standard Tests** (`ubuntu`, `debian`):
|
||||||
|
|
||||||
- Use the Docker targets defined in the main Dockerfile
|
- Use the Docker targets defined in the main Dockerfile
|
||||||
- Run the `test-setup.sh` script to check components
|
- Run the `test-setup.sh` script to check components
|
||||||
- Faster execution, focused on component validation
|
- Faster execution, focused on component validation
|
||||||
- Don't perform the actual bootstrap installation
|
- Don't perform the actual bootstrap installation
|
||||||
|
|
||||||
**Full Tests** (`full-ubuntu`, `full-debian`):
|
**Full Tests** (`full-ubuntu`, `full-debian`):
|
||||||
|
|
||||||
- Create a temporary Dockerfile for comprehensive testing
|
- Create a temporary Dockerfile for comprehensive testing
|
||||||
- Execute the bootstrap script directly from GitHub
|
- Execute the bootstrap script directly from GitHub
|
||||||
- Complete end-to-end testing of the actual installation process
|
- Complete end-to-end testing of the actual installation process
|
||||||
@@ -123,10 +127,12 @@ The test provides:
|
|||||||
## Adding New Tests
|
## Adding New Tests
|
||||||
|
|
||||||
To add new package tests:
|
To add new package tests:
|
||||||
|
|
||||||
1. Add the package name to `setup/packages.list`
|
1. Add the package name to `setup/packages.list`
|
||||||
2. The test framework will automatically validate its availability and installation
|
2. The test framework will automatically validate its availability and installation
|
||||||
|
|
||||||
For more complex components:
|
For more complex components:
|
||||||
|
|
||||||
1. Add a new test function in `test-setup.sh`
|
1. Add a new test function in `test-setup.sh`
|
||||||
2. Call the function in the main testing sequence
|
2. Call the function in the main testing sequence
|
||||||
3. Increment the error counter if the test fails
|
3. Increment the error counter if the test fails
|
||||||
|
|||||||
Reference in New Issue
Block a user