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:
@@ -7,6 +7,7 @@ The enhanced `backup-media.sh` script provides robust, enterprise-grade backup f
|
||||
## Features
|
||||
|
||||
### Core Functionality
|
||||
|
||||
- **Multi-service support**: Backs up 7 different media services
|
||||
- **Parallel execution**: Run multiple backups simultaneously for faster completion
|
||||
- **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
|
||||
|
||||
### Enhanced Logging
|
||||
|
||||
- **Multiple log formats**: Plain text, JSON, and Markdown reports
|
||||
- **Detailed tracking**: File sizes, checksums, timestamps, and status
|
||||
- **Performance logs**: JSON-formatted performance data for analysis
|
||||
- **Color-coded output**: Easy-to-read terminal output with status colors
|
||||
|
||||
### Safety Features
|
||||
|
||||
- **Dry run mode**: Preview operations without making changes
|
||||
- **Pre-flight checks**: Verify disk space and Docker availability
|
||||
- **Container verification**: Check if containers are running before backup
|
||||
- **Graceful error handling**: Continue with other services if one fails
|
||||
|
||||
### Maintenance
|
||||
|
||||
- **Automatic cleanup**: Remove old backups based on age and count limits
|
||||
- **Configurable retention**: Customize how many backups to keep
|
||||
- **Space management**: Monitor and report disk usage
|
||||
@@ -33,6 +37,7 @@ The enhanced `backup-media.sh` script provides robust, enterprise-grade backup f
|
||||
## Usage
|
||||
|
||||
### Basic Usage
|
||||
|
||||
```bash
|
||||
# Run standard backup
|
||||
./backup-media.sh
|
||||
@@ -64,6 +69,7 @@ The enhanced `backup-media.sh` script provides robust, enterprise-grade backup f
|
||||
## Configuration
|
||||
|
||||
### Environment Variables
|
||||
|
||||
The script uses several configurable parameters at the top of the file:
|
||||
|
||||
```bash
|
||||
@@ -82,6 +88,7 @@ PERFORMANCE_MONITORING=true # Track performance metrics
|
||||
```
|
||||
|
||||
### Services Configuration
|
||||
|
||||
The script automatically detects and backs up these services:
|
||||
|
||||
| Service | Container Path | Backup Content |
|
||||
@@ -97,12 +104,14 @@ The script automatically detects and backs up these services:
|
||||
## Output Files
|
||||
|
||||
### Log Files
|
||||
|
||||
- **Text Log**: `media-backup-YYYYMMDD_HHMMSS.log` - Standard log format
|
||||
- **Markdown Report**: `media-backup-YYYYMMDD_HHMMSS.md` - Human-readable report
|
||||
- **JSON Log**: `media-backup.json` - Machine-readable backup status
|
||||
- **Performance Log**: `media-backup-performance.json` - Performance metrics
|
||||
|
||||
### Backup Structure
|
||||
|
||||
```
|
||||
/mnt/share/media/backups/
|
||||
├── logs/
|
||||
@@ -142,6 +151,7 @@ WEBHOOK_URL="https://notify.peterwood.rocks/lab"
|
||||
```
|
||||
|
||||
Notification includes:
|
||||
|
||||
- Backup status (success/failure)
|
||||
- Number of successful/failed services
|
||||
- Total execution time
|
||||
@@ -150,12 +160,14 @@ Notification includes:
|
||||
## Performance Monitoring
|
||||
|
||||
When enabled, the script tracks:
|
||||
|
||||
- Individual service backup duration
|
||||
- Overall script execution time
|
||||
- Timestamps for performance analysis
|
||||
- JSON format for easy parsing and graphing
|
||||
|
||||
Example performance log entry:
|
||||
|
||||
```json
|
||||
{
|
||||
"timestamp": "2025-05-25T14:30:22-05:00",
|
||||
@@ -178,7 +190,9 @@ The script provides robust error handling:
|
||||
## Integration
|
||||
|
||||
### Cron Job
|
||||
|
||||
Add to crontab for automated daily backups:
|
||||
|
||||
```bash
|
||||
# Daily at 2 AM
|
||||
0 2 * * * /home/acedanger/shell/backup-media.sh >/dev/null 2>&1
|
||||
@@ -188,7 +202,9 @@ Add to crontab for automated daily backups:
|
||||
```
|
||||
|
||||
### Monitoring
|
||||
|
||||
Use the JSON logs for monitoring integration:
|
||||
|
||||
```bash
|
||||
# Check last backup status
|
||||
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
|
||||
|
||||
1. **Container Not Running**
|
||||
|
||||
```
|
||||
WARNING: Container 'sonarr' is not running
|
||||
```
|
||||
|
||||
- Verify the container is running: `docker ps`
|
||||
- Start the container: `docker start sonarr`
|
||||
|
||||
2. **Permission Denied**
|
||||
|
||||
```
|
||||
ERROR: Backup failed for sonarr
|
||||
```
|
||||
|
||||
- Check Docker permissions
|
||||
- Verify backup directory permissions
|
||||
- Ensure script has execute permissions
|
||||
|
||||
3. **Disk Space**
|
||||
|
||||
```
|
||||
ERROR: Insufficient disk space
|
||||
```
|
||||
|
||||
- Free up space in backup directory
|
||||
- Adjust `MAX_BACKUP_AGE_DAYS` for more aggressive cleanup
|
||||
- Run manual cleanup: `find /mnt/share/media/backups -mtime +7 -delete`
|
||||
|
||||
### Debug Mode
|
||||
|
||||
For troubleshooting, run with verbose output:
|
||||
|
||||
```bash
|
||||
# Enable debugging
|
||||
bash -x ./backup-media.sh --dry-run
|
||||
@@ -259,6 +283,7 @@ docker exec sonarr ls -la /config/Backups/scheduled
|
||||
## Future Enhancements
|
||||
|
||||
Potential improvements for future versions:
|
||||
|
||||
- Database integrity checking for specific services
|
||||
- Compression of backup archives
|
||||
- Remote backup destinations (S3, rsync, etc.)
|
||||
|
||||
Reference in New Issue
Block a user