mirror of
https://github.com/ChuckPa/PlexDBRepair.git
synced 2026-02-12 22:16:11 -06:00
Compare commits
3 Commits
9c1008cf52
...
91562060d1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91562060d1 | ||
|
|
4f5b5abdc8 | ||
|
|
b029ccebbb |
30
DBRepair.sh
30
DBRepair.sh
@@ -2,12 +2,12 @@
|
|||||||
#########################################################################
|
#########################################################################
|
||||||
# Plex Media Server database check and repair utility script. #
|
# Plex Media Server database check and repair utility script. #
|
||||||
# Maintainer: ChuckPa #
|
# Maintainer: ChuckPa #
|
||||||
# Version: v1.06.02 #
|
# Version: v1.07.00 #
|
||||||
# Date: 11-May-2024 #
|
# Date: 14-Jun-2024 #
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
# Version for display purposes
|
# Version for display purposes
|
||||||
Version="v1.06.02"
|
Version="v1.07.00"
|
||||||
|
|
||||||
# Have the databases passed integrity checks
|
# Have the databases passed integrity checks
|
||||||
CheckedDB=0
|
CheckedDB=0
|
||||||
@@ -575,7 +575,6 @@ HostConfig() {
|
|||||||
AppSuppDir="$HOME/Library/Application Support"
|
AppSuppDir="$HOME/Library/Application Support"
|
||||||
DBDIR="$AppSuppDir/Plex Media Server/Plug-in Support/Databases"
|
DBDIR="$AppSuppDir/Plex Media Server/Plug-in Support/Databases"
|
||||||
CACHEDIR="$HOME/Library/Caches/PlexMediaServer/PhotoTranscoder"
|
CACHEDIR="$HOME/Library/Caches/PlexMediaServer/PhotoTranscoder"
|
||||||
PID_FILE="$DBDIR/dbtmp/plexmediaserver.pid"
|
|
||||||
LOGFILE="$DBDIR/DBRepair.log"
|
LOGFILE="$DBDIR/DBRepair.log"
|
||||||
LOG_TOOL="logger"
|
LOG_TOOL="logger"
|
||||||
|
|
||||||
@@ -588,15 +587,11 @@ HostConfig() {
|
|||||||
# Root not required on MacOS. PMS runs as username.
|
# Root not required on MacOS. PMS runs as username.
|
||||||
RootRequired=0
|
RootRequired=0
|
||||||
|
|
||||||
# make the TMP directory in advance to store plexmediaserver.pid
|
# You can set haptic to 0 for silence.
|
||||||
mkdir -p "$DBDIR/dbtmp"
|
HaveStartStop=1
|
||||||
|
StartCommand=startMacPMS
|
||||||
# Remove stale PID file if it exists
|
StopCommand=stopMacPMS
|
||||||
[ -f "$PID_FILE" ] && rm "$PID_FILE"
|
HapticOkay=1
|
||||||
|
|
||||||
# If PMS is running create plexmediaserver.pid
|
|
||||||
PIDVALUE=$($PIDOF "Plex Media Server")
|
|
||||||
[ $PIDVALUE ] && echo $PIDVALUE > "$PID_FILE"
|
|
||||||
|
|
||||||
HostType="Mac"
|
HostType="Mac"
|
||||||
return 0
|
return 0
|
||||||
@@ -990,10 +985,11 @@ DoRepair() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Inform user
|
# Inform user
|
||||||
Output "Successfully exported the main and blobs databases. Proceeding to import into new databases."
|
Output "Successfully exported the main and blobs databases."
|
||||||
WriteLog "Repair - Export databases - PASS"
|
WriteLog "Repair - Export databases - PASS"
|
||||||
|
|
||||||
# Library and blobs successfully exported, create new
|
# Library and blobs successfully exported, create new
|
||||||
|
Output "Start importing into new databases."
|
||||||
Output "Importing Main DB."
|
Output "Importing Main DB."
|
||||||
DoSetPageSize "$TMPDIR/$CPPL.db-REPAIR-$TimeStamp"
|
DoSetPageSize "$TMPDIR/$CPPL.db-REPAIR-$TimeStamp"
|
||||||
"$PLEX_SQLITE" "$TMPDIR/$CPPL.db-REPAIR-$TimeStamp" < "$TMPDIR/library.plexapp.sql-$TimeStamp"
|
"$PLEX_SQLITE" "$TMPDIR/$CPPL.db-REPAIR-$TimeStamp" < "$TMPDIR/library.plexapp.sql-$TimeStamp"
|
||||||
@@ -1545,6 +1541,12 @@ DoStop(){
|
|||||||
return $Result
|
return $Result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Mac Helper Functions
|
||||||
|
startMacPMS() { TMPDIR=/tmp osascript -e 'tell app "Plex Media Server" to launch'; sleep 2; IsRunning && sayStarted; }
|
||||||
|
stopMacPMS() { osascript -e 'tell app "Plex Media Server" to quit'; sleep 2; IsRunning || sayStopped; }
|
||||||
|
sayStarted() { [ $HapticOkay -eq 1 ] && osascript -e 'say "started"'; }
|
||||||
|
sayStopped() { [ $HapticOkay -eq 1 ] && osascript -e 'say "Its stopped"'; }
|
||||||
|
|
||||||
# Do command line switches
|
# Do command line switches
|
||||||
#DoOptions() {
|
#DoOptions() {
|
||||||
|
|
||||||
|
|||||||
@@ -949,11 +949,11 @@ Enter command # -or- command name (4 char min) :
|
|||||||
# This script grants the given syno username (your username)
|
# This script grants the given syno username (your username)
|
||||||
# the ability to elevate to 'root' privilege for use with DBRepair.sh
|
# the ability to elevate to 'root' privilege for use with DBRepair.sh
|
||||||
#
|
#
|
||||||
# Set your desired Syno username here (no spaces)
|
# Set your desired Syno username here (no spaces in the username)
|
||||||
MyUsername=chuck
|
MyUsername="chuck"
|
||||||
|
|
||||||
# Confirm username exists
|
# Confirm username exists
|
||||||
if [ "$(id $MyUsername)" = "" ]; then
|
if [ "$(id "$MyUsername")" = "" ]; then
|
||||||
echo ERROR: No such user \'$MyUsername\'
|
echo ERROR: No such user \'$MyUsername\'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -8,7 +8,15 @@
|
|||||||

|

|
||||||
|
|
||||||
# Release Info:
|
# Release Info:
|
||||||
|
v1.07.00
|
||||||
|
|
||||||
|
1. Mac start/stop - DBRepair now supports start/stop from the menu.
|
||||||
|
Default configuration is for MacOS to tell you what it's doing (Haptic). Set to 0 for silence.
|
||||||
|
|
||||||
|
2. Code cleanup - Minor code cleanup / dead code removal.
|
||||||
|
|
||||||
v1.06.02
|
v1.06.02
|
||||||
|
|
||||||
1. Bug fix - Fixed incorrect error handling when command line arguments not valid in manual configuration mode.
|
1. Bug fix - Fixed incorrect error handling when command line arguments not valid in manual configuration mode.
|
||||||
Fixed incorrect reporting of what was wrong in manual configuration mode.
|
Fixed incorrect reporting of what was wrong in manual configuration mode.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user