mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 04:30:13 -08:00
feat: Add cleanup script for temporary and corrupted Plex database files
This commit is contained in:
@@ -307,6 +307,36 @@ $ ./check-plex-builtin-backups.sh
|
||||
./plex-recent-additions.sh # Generate recent additions report
|
||||
```
|
||||
|
||||
#### `cleanup-plex-databases.sh` ⭐ **NEW**
|
||||
**Safe cleanup of temporary and corrupted database files**
|
||||
|
||||
**Features:**
|
||||
- Removes temporary files, recovery files, and corrupted directories
|
||||
- Preserves active databases and legitimate backups
|
||||
- Dry-run mode for safe preview
|
||||
- Comprehensive safety checks and validation
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
./cleanup-plex-databases.sh --dry-run # Preview what will be removed
|
||||
sudo ./cleanup-plex-databases.sh # Perform actual cleanup
|
||||
./cleanup-plex-databases.sh --help # Show all options
|
||||
```
|
||||
|
||||
**What it removes:**
|
||||
- Temporary files (`*-tmp`, `*-2025-*-tmp`)
|
||||
- MD5 checksum files (`*.md5`)
|
||||
- Recovery files (`*recovery*`)
|
||||
- Repaired files (`*repaired*`)
|
||||
- Empty backup files (`*empty-backup*`)
|
||||
- Repair log files (`DBRepair.log`)
|
||||
- Corrupted database directories (`corrupted-*`)
|
||||
|
||||
**What it preserves:**
|
||||
- Active database files (`*.db`, `*.db-shm`, `*.db-wal`)
|
||||
- Plex built-in backups (`*.backup.*`)
|
||||
- Historical dated backups (`*.db.YYYYMMDD`)
|
||||
- EPG databases (`tv.plex.providers.epg.cloud-*.db`)
|
||||
### 🧪 Testing & Integration
|
||||
|
||||
#### `test-plex-backup.sh`
|
||||
|
||||
Reference in New Issue
Block a user