mirror of
https://github.com/ChuckPa/PlexDBRepair.git
synced 2025-11-06 03:08:55 -05:00
Version 1.0.5
1. Add Arch Linux support 2. Improve override file processing 3. Documentation cleanup
This commit is contained in:
parent
7717283a5a
commit
c00a52fda4
88
DBRepair.sh
88
DBRepair.sh
@ -2,12 +2,12 @@
|
||||
#########################################################################
|
||||
# Plex Media Server database check and repair utility script. #
|
||||
# Maintainer: ChuckPa #
|
||||
# Version: v1.0.3 #
|
||||
# Date: 27-Mar-2023 #
|
||||
# Version: v1.0.5 #
|
||||
# Date: 04-May-2023 #
|
||||
#########################################################################
|
||||
|
||||
# Version for display purposes
|
||||
Version="v1.0.3"
|
||||
Version="v1.0.5"
|
||||
|
||||
# Flag when temp files are to be retained
|
||||
Retain=0
|
||||
@ -17,7 +17,6 @@ CheckedDB=0
|
||||
|
||||
# By default, we cannot start/stop PMS
|
||||
HaveStartStop=0
|
||||
StartStopUser=0
|
||||
StartCommand=""
|
||||
StopCommand=""
|
||||
|
||||
@ -294,6 +293,37 @@ GetSize() {
|
||||
echo $Size
|
||||
}
|
||||
|
||||
# Extract specified value from override file if it exists (Null if not)
|
||||
GetOverride() {
|
||||
|
||||
Retval=""
|
||||
|
||||
# Don't know if we have pushd so do it long hand
|
||||
CurrDir="$(pwd)"
|
||||
|
||||
# Find the metadata dir if customized
|
||||
if [ -e /etc/systemd/system/plexmediaserver.service.d ]; then
|
||||
|
||||
# Get there
|
||||
cd /etc/systemd/system/plexmediaserver.service.d
|
||||
|
||||
# Glob up all 'conf files' found
|
||||
ConfFile="$(find override.conf local.conf *.conf 2>/dev/null | uniq)"
|
||||
|
||||
# If there is one, search it
|
||||
if [ "$ConfFile" != "" ]; then
|
||||
Retval="$(grep "$1" $ConfFile | head -1 | sed -e "s/.*${1}=//" | tr -d \" | tr -d \')"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Go back to where we were
|
||||
cd "$CurrDir"
|
||||
|
||||
# What did we find
|
||||
echo "$Retval"
|
||||
}
|
||||
|
||||
# Determine which host we are running on and set variables
|
||||
HostConfig() {
|
||||
|
||||
@ -405,13 +435,48 @@ HostConfig() {
|
||||
# Find the metadata dir if customized
|
||||
if [ -e /etc/systemd/system/plexmediaserver.service.d ]; then
|
||||
|
||||
# Glob up all 'conf files' found
|
||||
NewSuppDir="$(cd /etc/systemd/system/plexmediaserver.service.d ; \
|
||||
cat override.conf local.conf *.conf 2>/dev/null | grep "APPLICATION_SUPPORT_DIR" | head -1)"
|
||||
# Get custom AppSuppDir if specified
|
||||
NewSuppDir="$(GetOverride PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR)"
|
||||
|
||||
if [ -d "$NewSuppDir" ]; then
|
||||
AppSuppDir="$NewSuppDir"
|
||||
else
|
||||
Output "Given application support directory override specified does not exist: '$NewSuppDir'. Ignoring."
|
||||
fi
|
||||
fi
|
||||
|
||||
DBDIR="$AppSuppDir/Plex Media Server/Plug-in Support/Databases"
|
||||
PID_FILE="$AppSuppDir/Plex Media Server/plexmediaserver.pid"
|
||||
LOGFILE="$DBDIR/DBRepair.log"
|
||||
|
||||
HostType="$(grep ^PRETTY_NAME= /etc/os-release | sed -e 's/PRETTY_NAME=//' | sed -e 's/"//g')"
|
||||
|
||||
HaveStartStop=1
|
||||
StartCommand="systemctl start plexmediaserver"
|
||||
StopCommand="systemctl stop plexmediaserver"
|
||||
return 0
|
||||
|
||||
# Arch Linux
|
||||
elif [ -e /etc/os-release ] && [ "$(grep 'Arch Linux' /etc/os-release)" != "" ] && \
|
||||
[ -d /usr/lib/plexmediaserver ] && \
|
||||
[ -d /var/lib/plex ]; then
|
||||
|
||||
|
||||
# Where is the software
|
||||
PKGDIR="/usr/lib/plexmediaserver"
|
||||
PLEX_SQLITE="$PKGDIR/Plex SQLite"
|
||||
LOG_TOOL="logger"
|
||||
|
||||
# Where is the data
|
||||
AppSuppDir="/var/lib/plex"
|
||||
|
||||
# Find the metadata dir if customized
|
||||
if [ -e /etc/systemd/system/plexmediaserver.service.d ]; then
|
||||
|
||||
# Get custom AppSuppDir if specified
|
||||
NewSuppDir="$(GetOverride PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR)"
|
||||
|
||||
if [ "$NewSuppDir" != "" ]; then
|
||||
NewSuppDir="$(echo $NewSuppDir | sed -e 's/.*_DIR=//' | tr -d '"' | tr -d "'")"
|
||||
|
||||
if [ -d "$NewSuppDir" ]; then
|
||||
AppSuppDir="$NewSuppDir"
|
||||
else
|
||||
@ -421,10 +486,9 @@ HostConfig() {
|
||||
fi
|
||||
|
||||
DBDIR="$AppSuppDir/Plex Media Server/Plug-in Support/Databases"
|
||||
PID_FILE="$AppSuppDir/Plex Media Server/plexmediaserver.pid"
|
||||
LOGFILE="$DBDIR/DBRepair.log"
|
||||
|
||||
HostType="$(grep ^PRETTY_NAME= /etc/os-release | sed -e 's/PRETTY_NAME=//' | sed -e 's/"//g')"
|
||||
LOG_TOOL="logger"
|
||||
HostType="Arch Linux"
|
||||
|
||||
HaveStartStop=1
|
||||
StartCommand="systemctl start plexmediaserver"
|
||||
|
||||
@ -98,9 +98,10 @@ If sufficient privleges exist (root), and supported by the environment, the opti
|
||||
They will likely be supported by the container/VM PMS runs in.
|
||||
|
||||
```
|
||||
Vendor | Shared folder name | directory
|
||||
Vendor | Shared folder name | Recommended directory
|
||||
-------------------+---------------------+------------------------------------------
|
||||
Apple | Downloads | ~/Downloads
|
||||
Arch Linux | N/A | Anywhere
|
||||
ASUSTOR | Public | /volume1/Public
|
||||
binhex | N/A | Container root (adjacent /config)
|
||||
Docker | N/A | Container root (adjacent /config)
|
||||
@ -130,16 +131,16 @@ If sufficient privleges exist (root), and supported by the environment, the opti
|
||||
|
||||
|
||||
|
||||
### EXAMPLE: To install & launch on Synology DSM 6 / DSM 7
|
||||
|
||||
### EXAMPLE: To install & launch on Synology DSM 6
|
||||
|
||||
cd /volume1/Plex # /volume1/PlexMediaServer on DSM 7
|
||||
cd /volume1/Plex (/volume1/PlexMediaServer on DSM 7)
|
||||
sudo bash
|
||||
tar xf PlexDBRepair-x.y.z.tar.gz
|
||||
cd PlexDBRepair-x.y.z
|
||||
chmod +x DBRepair.sh
|
||||
./DBRepair.sh
|
||||
|
||||
|
||||
### EXAMPLE: Using DBRepair inside containers (manual start/stop included)
|
||||
|
||||
#### (Select containers allow stopping/starting PMS from the menu. See menu for details)
|
||||
|
||||
41
ReleaseNotes
41
ReleaseNotes
@ -7,16 +7,31 @@
|
||||
[]('')
|
||||

|
||||
|
||||
# Release Info:
|
||||
|
||||
v1.0.5
|
||||
- Add Arch Linux Support
|
||||
- Put system override processing in funtion
|
||||
|
||||
v1.0.4
|
||||
- Correct Start/Stop problem on some hosts
|
||||
|
||||
v1.0.3
|
||||
- Use POSIX free space calculation on all systems
|
||||
|
||||
# Introduction
|
||||
|
||||
DBRepair provides database repair and maintenance for the most common Plex Media Server database problems.
|
||||
It is a simple menu-driven utility with a command line backend.
|
||||
|
||||
While it does correct the following errors, it can't correct 'data' errors with the individual records.
|
||||
These type changes can only be performed by PMS.
|
||||
## Situations and errors commonly seen include:
|
||||
|
||||
1. Searching is sluggish
|
||||
2. Database is malformed / damaged / corrupted
|
||||
3. Database has bloated from media addition or changes
|
||||
4. Damaged indexes damaged
|
||||
1. Searching is sluggish
|
||||
2. Database is malformed / damaged / corrupted
|
||||
3. Database has bloated from media addition or changes
|
||||
4. Damaged indexes damaged
|
||||
|
||||
## Functions provided
|
||||
|
||||
@ -71,18 +86,19 @@ It is a simple menu-driven utility with a command line backend.
|
||||
## Hosts currently supported
|
||||
|
||||
1. Apple (MacOS)
|
||||
2. ASUSTOR
|
||||
3. Docker containers via 'docker exec' command (inside the running container environment)
|
||||
2. Arch Linux
|
||||
3. ASUSTOR
|
||||
4. Docker containers via 'docker exec' command (inside the running container environment)
|
||||
- Plex,inc.
|
||||
- Linuxserver.io
|
||||
- BINHEX
|
||||
- HOTIO
|
||||
- Podman (libgpod)
|
||||
4. Linux workstation & server
|
||||
5. Netgear (OS5 Linux-based systems)
|
||||
6. QNAP (QTS & QuTS)
|
||||
7. Synology (DSM 6 & DSM 7)
|
||||
8. Western Digital (OS5)
|
||||
5. Linux workstation & server
|
||||
6. Netgear (OS5 Linux-based systems)
|
||||
7. QNAP (QTS & QuTS)
|
||||
8. Synology (DSM 6 & DSM 7)
|
||||
9. Western Digital (OS5)
|
||||
|
||||
# Installation
|
||||
|
||||
@ -90,9 +106,10 @@ It is a simple menu-driven utility with a command line backend.
|
||||
Please use this table as a reference.
|
||||
|
||||
```
|
||||
Vendor | Shared folder name | directory
|
||||
Vendor | Shared folder name | Recommended directory
|
||||
-------------------+---------------------+------------------------------------------
|
||||
Apple | Downloads | ~/Downloads
|
||||
Arch Linux | N/A | Anywhere
|
||||
ASUSTOR | Public | /volume1/Public
|
||||
binhex | N/A | Container root (adjacent /config)
|
||||
Docker | N/A | Container root (adjacent /config)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user