mirror of
https://github.com/ChuckPa/PlexDBRepair.git
synced 2026-02-12 05:56:11 -06:00
Compare commits
2 Commits
be74c6f85e
...
98c5274d86
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98c5274d86 | ||
|
|
1c1ed5a8c1 |
17
DBRepair.sh
17
DBRepair.sh
@@ -1,13 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Plex Media Server database check and repair utility script. #
|
# Database Repair Utility for Plex Media Server. #
|
||||||
# Maintainer: ChuckPa #
|
# Maintainer: ChuckPa #
|
||||||
# Version: v1.10.06 #
|
# Version: v1.11.00 #
|
||||||
# Date: 23-May-2025 #
|
# Date: 23-May-2025 #
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
# Version for display purposes
|
# Version for display purposes
|
||||||
Version="v1.10.06"
|
Version="v1.11.00"
|
||||||
|
|
||||||
# Have the databases passed integrity checks
|
# Have the databases passed integrity checks
|
||||||
CheckedDB=0
|
CheckedDB=0
|
||||||
@@ -1639,7 +1639,7 @@ DoUpdateTimestamp() {
|
|||||||
|
|
||||||
# Get latest version from Github
|
# Get latest version from Github
|
||||||
GetLatestRelease() {
|
GetLatestRelease() {
|
||||||
Response=$(curl -s "https://api.github.com/repos/ChuckPa/PlexDBRepair/tags")
|
Response=$(curl -sL "https://api.github.com/repos/ChuckPa/DBRepair/tags")
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
LatestVersion="$(echo "$Response" | grep name | awk -F: '{print $2}' | sort -r | head -1 | tr -d \" | tr -d ' ' | tr -d ',')"
|
LatestVersion="$(echo "$Response" | grep name | awk -F: '{print $2}' | sort -r | head -1 | tr -d \" | tr -d ' ' | tr -d ',')"
|
||||||
else
|
else
|
||||||
@@ -1654,7 +1654,7 @@ DownloadAndUpdate() {
|
|||||||
Filename="$2"
|
Filename="$2"
|
||||||
|
|
||||||
# Download the file and check if the download was successful
|
# Download the file and check if the download was successful
|
||||||
if curl -s "$Url" --output "${Filename}.tmp"; then
|
if curl -sL "$Url" --output "${Filename}.tmp"; then
|
||||||
# Check if the file was written to and at least 50000 bytes
|
# Check if the file was written to and at least 50000 bytes
|
||||||
if [ -f "${Filename}.tmp" ]; then
|
if [ -f "${Filename}.tmp" ]; then
|
||||||
if [ $(stat $STATFMT $STATBYTES "${Filename}.tmp") -gt 50000 ]; then
|
if [ $(stat $STATFMT $STATBYTES "${Filename}.tmp") -gt 50000 ]; then
|
||||||
@@ -1912,7 +1912,7 @@ do
|
|||||||
|
|
||||||
echo " "
|
echo " "
|
||||||
echo " "
|
echo " "
|
||||||
echo " Plex Media Server Database Repair Utility ($HostType)"
|
echo " Database Repair Utility for Plex Media Server ($HostType)"
|
||||||
echo " Version $Version"
|
echo " Version $Version"
|
||||||
echo " "
|
echo " "
|
||||||
|
|
||||||
@@ -2300,9 +2300,6 @@ do
|
|||||||
Records=$("$PLEX_SQLITE" "$DBDIR/com.plexapp.plugins.library.db" "select count(*) from $Table;")
|
Records=$("$PLEX_SQLITE" "$DBDIR/com.plexapp.plugins.library.db" "select count(*) from $Table;")
|
||||||
printf "%36s %-15d\n" $Table $Records
|
printf "%36s %-15d\n" $Table $Records
|
||||||
done
|
done
|
||||||
|
|
||||||
# Cleanup
|
|
||||||
rm -f "$Temp" "$Temp2"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
# Ignore/Honor errors
|
# Ignore/Honor errors
|
||||||
@@ -2332,7 +2329,7 @@ do
|
|||||||
if [ $DoUpdate -eq 1 ]; then
|
if [ $DoUpdate -eq 1 ]; then
|
||||||
if [ -w "$ScriptWorkingDirectory" ]; then
|
if [ -w "$ScriptWorkingDirectory" ]; then
|
||||||
Output "Updating from $Version to $LatestVersion"
|
Output "Updating from $Version to $LatestVersion"
|
||||||
DownloadAndUpdate "https://raw.githubusercontent.com/ChuckPa/PlexDBRepair/master/DBRepair.sh" "$ScriptWorkingDirectory/$ScriptName"
|
DownloadAndUpdate "https://raw.githubusercontent.com/ChuckPa/DBRepair/master/DBRepair.sh" "$ScriptWorkingDirectory/$ScriptName"
|
||||||
Result=$?
|
Result=$?
|
||||||
if [ $Result -eq 0 ]; then
|
if [ $Result -eq 0 ]; then
|
||||||
chmod +x "$ScriptWorkingDirectory/$ScriptName"
|
chmod +x "$ScriptWorkingDirectory/$ScriptName"
|
||||||
|
|||||||
42
README.md
42
README.md
@@ -1,9 +1,9 @@
|
|||||||
# PlexDBRepair
|
# DBRepair (for Plex Media Server)
|
||||||
|
|
||||||
[](https://github.com/ChuckPa/PlexDBRepair/issues)
|
[](https://github.com/ChuckPa/DBRepair/issues)
|
||||||
[](https://github.com/ChuckPa/PlexDBRepair/releases/latest)
|
[](https://github.com/ChuckPa/DBRepair/releases/latest)
|
||||||
[](https://github.com/ChuckPa/PlexDBRepair/releases/latest)
|
[](https://github.com/ChuckPa/DBRepair/releases/latest)
|
||||||
[](https://github.com/ChuckPa/PlexDBRepair/releases)
|
[](https://github.com/ChuckPa/DBRepair/releases)
|
||||||
[]('')
|
[]('')
|
||||||

|

|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ If sufficient privleges exist (root), and supported by the environment, the opti
|
|||||||
For clarity, each command's name is 'quoted'.
|
For clarity, each command's name is 'quoted'.
|
||||||
|
|
||||||
```
|
```
|
||||||
Plex Media Server Database Repair Utility (_host_configuration_name_)
|
Database Repair Utility for Plex Media Server (_host_configuration_name_)
|
||||||
Version v1.09.00
|
Version v1.09.00
|
||||||
|
|
||||||
Select
|
Select
|
||||||
@@ -134,10 +134,10 @@ Enter command # -or- command name (4 char min) :
|
|||||||
|
|
||||||
### General installation and usage instructions
|
### General installation and usage instructions
|
||||||
|
|
||||||
1. Open your browser to https://github.com/ChuckPa/PlexDBRepair/releases/latest
|
1. Open your browser to https://github.com/ChuckPa/DBRepair/releases/latest
|
||||||
2. Download the source code (tar.gz or ZIP) file
|
2. Download the source code (tar.gz or ZIP) file
|
||||||
|
|
||||||
3. Knowing the file name will always be of the form 'PlexDBRepair-X.Y.Z.tar.gz'
|
3. Knowing the file name will always be of the form 'DBRepair-X.Y.Z.tar.gz'
|
||||||
-- where X.Y.Z is the release number. Use the real values in place of X, Y, and Z.
|
-- where X.Y.Z is the release number. Use the real values in place of X, Y, and Z.
|
||||||
4. Place the tar.gz file in the appropriate directory on the system you'll use it.
|
4. Place the tar.gz file in the appropriate directory on the system you'll use it.
|
||||||
5. Open a command line session (usually Terminal or SSH)
|
5. Open a command line session (usually Terminal or SSH)
|
||||||
@@ -156,8 +156,8 @@ Enter command # -or- command name (4 char min) :
|
|||||||
|
|
||||||
cd /volume1/Plex # use /volume1/PlexMediaServer on DSM 7
|
cd /volume1/Plex # use /volume1/PlexMediaServer on DSM 7
|
||||||
sudo bash
|
sudo bash
|
||||||
tar xf PlexDBRepair-x.y.z.tar.gz
|
tar xf DBRepair-x.y.z.tar.gz
|
||||||
cd PlexDBRepair-x.y.z
|
cd DBRepair-x.y.z
|
||||||
chmod +x DBRepair.sh
|
chmod +x DBRepair.sh
|
||||||
./DBRepair.sh
|
./DBRepair.sh
|
||||||
|
|
||||||
@@ -168,8 +168,8 @@ Enter command # -or- command name (4 char min) :
|
|||||||
sudo docker exec -it plex /bin/bash
|
sudo docker exec -it plex /bin/bash
|
||||||
|
|
||||||
# extract from downloaded version file name then cd into directory
|
# extract from downloaded version file name then cd into directory
|
||||||
tar xf PlexDBRepair-x.y.z.tar.gz
|
tar xf DBRepair-x.y.z.tar.gz
|
||||||
cd PlexDBRepair-x.y.z
|
cd DBRepair-x.y.z
|
||||||
chmod +x DBRepair.sh
|
chmod +x DBRepair.sh
|
||||||
./DBRepair.sh
|
./DBRepair.sh
|
||||||
```
|
```
|
||||||
@@ -177,8 +177,8 @@ Enter command # -or- command name (4 char min) :
|
|||||||
```
|
```
|
||||||
sudo bash
|
sudo bash
|
||||||
cd /path/to/DBRepair.tar
|
cd /path/to/DBRepair.tar
|
||||||
tar xf PlexDBRepair-x.y.z.tar.gz
|
tar xf DBRepair-x.y.z.tar.gz
|
||||||
cd PlexDBRepair-x.y.z
|
cd DBRepair-x.y.z
|
||||||
chmod +x DBRepair.sh
|
chmod +x DBRepair.sh
|
||||||
./DBRepair.sh stop auto start exit
|
./DBRepair.sh stop auto start exit
|
||||||
```
|
```
|
||||||
@@ -187,8 +187,8 @@ Enter command # -or- command name (4 char min) :
|
|||||||
```
|
```
|
||||||
osascript -e 'quit app "Plex Media Server"'
|
osascript -e 'quit app "Plex Media Server"'
|
||||||
cd ~/Downloads
|
cd ~/Downloads
|
||||||
tar xf PlexDBRepair-x.y.z.tar.gz
|
tar xf DBRepair-x.y.z.tar.gz
|
||||||
cd PlexDBRepair-x.y.z
|
cd DBRepair-x.y.z
|
||||||
|
|
||||||
chmod +x DBRepair.sh
|
chmod +x DBRepair.sh
|
||||||
./DBRepair.sh
|
./DBRepair.sh
|
||||||
@@ -220,7 +220,7 @@ These examples
|
|||||||
|
|
||||||
C. Database is malformed - No Backups
|
C. Database is malformed - No Backups
|
||||||
1. (3) Check - Confirm either main or blobs database is damaged
|
1. (3) Check - Confirm either main or blobs database is damaged
|
||||||
2. (5) Repair - Salavage as much as possible from the databases and rebuild them into a usable database.
|
2. (5) Repair - Salvage as much as possible from the databases and rebuild them into a usable database.
|
||||||
3. (6) Reindex - Generate new indexes so PMS doesn't need to at startup
|
3. (6) Reindex - Generate new indexes so PMS doesn't need to at startup
|
||||||
4. (99) Exit
|
4. (99) Exit
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ bash-4.4# ./DBRepair.sh
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Plex Media Server Database Repair Utility (Ubuntu 20.04.6 LTS)
|
Database Repair Utility for Plex Media Server (Ubuntu 20.04.6 LTS)
|
||||||
Version v1.03.01
|
Version v1.03.01
|
||||||
|
|
||||||
Select
|
Select
|
||||||
@@ -514,7 +514,7 @@ root@lizum:/sata/plex/Plex Media Server/Plug-in Support/Databases# ./DBRepair.sh
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Plex Media Server Database Repair Utility (Ubuntu 20.04.5 LTS)
|
Database Repair Utility for Plex Media Server (Ubuntu 20.04.5 LTS)
|
||||||
Version v1.03.01
|
Version v1.03.01
|
||||||
|
|
||||||
|
|
||||||
@@ -823,7 +823,7 @@ root@lizum:/sata/plex/Plex Media Server/Plug-in Support/Databases#
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Plex Media Server Database Repair Utility (Ubuntu 22.04.3 LTS)
|
Database Repair Utility for Plex Media Server (Ubuntu 22.04.3 LTS)
|
||||||
Version v1.03.01
|
Version v1.03.01
|
||||||
|
|
||||||
|
|
||||||
@@ -913,7 +913,7 @@ root@Jasper:/mnt/user/appdata/PlexMediaServer# /tmp/DBRepair.sh --databases /mnt
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Plex Media Server Database Repair Utility (User Defined)
|
Database Repair Utility for Plex Media Server (User Defined)
|
||||||
Version v1.09.00
|
Version v1.09.00
|
||||||
|
|
||||||
PlexSQLite = '/var/lib/docker/btrfs/subvolumes/4bb78fb70589d4d2ba56754f4d6bc0edd4cdaa8eab7986943767e09a66cefd19/usr/lib/plexmediaserver//Plex SQLite'
|
PlexSQLite = '/var/lib/docker/btrfs/subvolumes/4bb78fb70589d4d2ba56754f4d6bc0edd4cdaa8eab7986943767e09a66cefd19/usr/lib/plexmediaserver//Plex SQLite'
|
||||||
|
|||||||
42
ReleaseNotes
42
ReleaseNotes
@@ -1,13 +1,19 @@
|
|||||||
# PlexDBRepair
|
# DBRepair
|
||||||
|
|
||||||
[](https://github.com/ChuckPa/PlexDBRepair/issues)
|
[](https://github.com/ChuckPa/DBRepair/issues)
|
||||||
[](https://github.com/ChuckPa/PlexDBRepair/releases/latest)
|
[](https://github.com/ChuckPa/DBRepair/releases/latest)
|
||||||
[](https://github.com/ChuckPa/PlexDBRepair/releases/latest)
|
[](https://github.com/ChuckPa/DBRepair/releases/latest)
|
||||||
[](https://github.com/ChuckPa/PlexDBRepair/releases)
|
[](https://github.com/ChuckPa/DBRepair/releases)
|
||||||
[]('')
|
[]('')
|
||||||

|

|
||||||
|
|
||||||
# Release Info:
|
# Release Info:
|
||||||
|
v1.11.00
|
||||||
|
|
||||||
|
1. Rename Utility - Rename this tool to be compliant with Plex inc. Trademark Policy.
|
||||||
|
Update all documentation
|
||||||
|
Update Github repository
|
||||||
|
|
||||||
v1.10.06
|
v1.10.06
|
||||||
|
|
||||||
1. Update tags - When updating, DBRepair would not format cleanly. This update corrects that formatting.
|
1. Update tags - When updating, DBRepair would not format cleanly. This update corrects that formatting.
|
||||||
@@ -272,7 +278,7 @@ These type changes can only be performed by PMS.
|
|||||||
For clarity, each command's name is 'quoted'.
|
For clarity, each command's name is 'quoted'.
|
||||||
|
|
||||||
|
|
||||||
Plex Media Server Database Repair Utility (_host_configuration_name_)
|
Database Repair Utility for Plex Media Server (_host_configuration_name_)
|
||||||
Version v1.0.0
|
Version v1.0.0
|
||||||
|
|
||||||
Select
|
Select
|
||||||
@@ -337,10 +343,10 @@ These type changes can only be performed by PMS.
|
|||||||
|
|
||||||
### General installation and usage instructions
|
### General installation and usage instructions
|
||||||
|
|
||||||
1. Open your browser to https://github.com/ChuckPa/PlexDBRepair/releases/latest
|
1. Open your browser to https://github.com/ChuckPa/DBRepair/releases/latest
|
||||||
2. Download the source code (tar.gz or ZIP) file
|
2. Download the source code (tar.gz or ZIP) file
|
||||||
|
|
||||||
3. Knowing the file name will always be of the form 'PlexDBRepair-X.Y.Z.tar.gz'
|
3. Knowing the file name will always be of the form 'DBRepair-X.Y.Z.tar.gz'
|
||||||
-- where X.Y.Z is the release number. Use the real values in place of X, Y, and Z.
|
-- where X.Y.Z is the release number. Use the real values in place of X, Y, and Z.
|
||||||
4. Place the tar.gz file in the appropriate directory on the system you'll use it.
|
4. Place the tar.gz file in the appropriate directory on the system you'll use it.
|
||||||
5. Open a command line session (usually Terminal or SSH)
|
5. Open a command line session (usually Terminal or SSH)
|
||||||
@@ -357,8 +363,8 @@ These type changes can only be performed by PMS.
|
|||||||
|
|
||||||
cd /volume1/Plex
|
cd /volume1/Plex
|
||||||
sudo bash
|
sudo bash
|
||||||
tar xf PlexDBRepair-x.y.z.tar.gz
|
tar xf DBRepair-x.y.z.tar.gz
|
||||||
cd PlexDBRepair-x.y.z
|
cd DBRepair-x.y.z
|
||||||
chmod +x DBRepair.sh
|
chmod +x DBRepair.sh
|
||||||
./DBRepair.sh
|
./DBRepair.sh
|
||||||
|
|
||||||
@@ -370,8 +376,8 @@ These type changes can only be performed by PMS.
|
|||||||
sudo docker exec -it plex /bin/bash
|
sudo docker exec -it plex /bin/bash
|
||||||
|
|
||||||
# extract from downloaded version file name then cd into directory
|
# extract from downloaded version file name then cd into directory
|
||||||
tar xf PlexDBRepair-1.0.0.tar.gz
|
tar xf DBRepair-1.0.0.tar.gz
|
||||||
cd PlexDBRepair-1.0.0
|
cd DBRepair-1.0.0
|
||||||
chmod +x DBRepair.sh
|
chmod +x DBRepair.sh
|
||||||
./DBRepair.sh
|
./DBRepair.sh
|
||||||
```
|
```
|
||||||
@@ -379,8 +385,8 @@ These type changes can only be performed by PMS.
|
|||||||
```
|
```
|
||||||
sudo bash
|
sudo bash
|
||||||
cd /path/to/DBRepair.tar
|
cd /path/to/DBRepair.tar
|
||||||
tar xf PlexDBRepair-1.0.0.tar.gz
|
tar xf DBRepair-1.0.0.tar.gz
|
||||||
cd PlexDBRepair-1.0.0
|
cd DBRepair-1.0.0
|
||||||
chmod +x DBRepair.sh
|
chmod +x DBRepair.sh
|
||||||
./DBRepair.sh stop auto start exit
|
./DBRepair.sh stop auto start exit
|
||||||
```
|
```
|
||||||
@@ -389,8 +395,8 @@ These type changes can only be performed by PMS.
|
|||||||
```
|
```
|
||||||
osascript -e 'quit app "Plex Media Server"'
|
osascript -e 'quit app "Plex Media Server"'
|
||||||
cd ~/Downloads
|
cd ~/Downloads
|
||||||
tar xvf PlexDBRepai PlexDBRepair-1.0.0.tar.gz
|
tar xvf PlexDBRepai DBRepair-1.0.0.tar.gz
|
||||||
cd PlexDBRepai PlexDBRepair-1.0.0
|
cd PlexDBRepai DBRepair-1.0.0
|
||||||
|
|
||||||
chmod +x DBRepair.sh
|
chmod +x DBRepair.sh
|
||||||
./DBRepair.sh
|
./DBRepair.sh
|
||||||
@@ -495,7 +501,7 @@ bash-4.4# ./DBRepair.sh
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Plex Media Server Database Repair Utility (Synology (DSM 7))
|
Database Repair Utility for Plex Media Server (Synology (DSM 7))
|
||||||
Version v1.0.0
|
Version v1.0.0
|
||||||
|
|
||||||
|
|
||||||
@@ -648,7 +654,7 @@ root@lizum:/sata/plex/Plex Media Server/Plug-in Support/Databases# ./DBRepair.sh
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Plex Media Server Database Repair Utility (Ubuntu 20.04.5 LTS)
|
Database Repair Utility for Plex Media Server (Ubuntu 20.04.5 LTS)
|
||||||
Version v1.0.0
|
Version v1.0.0
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user