mirror of
https://github.com/ChuckPa/PlexDBRepair.git
synced 2025-11-06 11:18:54 -05:00
Add License.md, size Reports, README.
This commit is contained in:
parent
43323e8cbf
commit
00e1080049
41
DBRepair.sh
Normal file → Executable file
41
DBRepair.sh
Normal file → Executable file
@ -105,7 +105,7 @@ GetDates(){
|
||||
Date="$(echo $i | sed -e 's/.*.db-//')"
|
||||
|
||||
# Only add if companion blobs DB exists
|
||||
[ -e "$CPPL.blobs.db-$Date" ] && echo $Date >> "$Tempfile"
|
||||
[ -e $CPPL.blobs.db-$Date ] && echo $Date >> "$Tempfile"
|
||||
|
||||
done
|
||||
|
||||
@ -243,6 +243,15 @@ RestoreSaved() {
|
||||
done
|
||||
}
|
||||
|
||||
# Get the size of the given DB in MB
|
||||
GetSize() {
|
||||
|
||||
Size=$(stat -c %s "$1")
|
||||
Size=$(expr $Size / 1048576)
|
||||
[ $Size -eq 0 ] && Size=1
|
||||
echo $Size
|
||||
}
|
||||
|
||||
# Determine which host we are running on and set variables
|
||||
HostConfig() {
|
||||
|
||||
@ -555,11 +564,16 @@ do
|
||||
|
||||
# Start vacuuming
|
||||
Output "Vacuuming main database"
|
||||
SizeStart=$(GetSize $CPPL.db)
|
||||
|
||||
# Vacuum it
|
||||
"$PLEX_SQLITE" $CPPL.db 'VACUUM;'
|
||||
Result=$?
|
||||
|
||||
if SQLiteOK $Result; then
|
||||
Output "Vacuuming main database successful."
|
||||
WriteLog "Vacuum - Vacuum main database - PASS"
|
||||
SizeFinish=$(GetSize $CPPL.db)
|
||||
Output "Vacuuming main database successful (Size: ${SizeStart}MB/${SizeFinish}MB)."
|
||||
WriteLog "Vacuum - Vacuum main database - PASS (Size: ${SizeStart}MB/${SizeFinish}MB)."
|
||||
else
|
||||
Output "Vaccuming main database failed. Error code $Result from Plex SQLite"
|
||||
WriteLog "Vacuum - Vacuum main database - FAIL ($Result)"
|
||||
@ -567,13 +581,18 @@ do
|
||||
fi
|
||||
|
||||
Output "Vacuuming blobs database"
|
||||
SizeStart=$(GetSize $CPPL.blobs.db)
|
||||
|
||||
# Vacuum it
|
||||
"$PLEX_SQLITE" $CPPL.blobs.db 'VACUUM;'
|
||||
Result=$?
|
||||
|
||||
if SQLiteOK $Result; then
|
||||
Output "Vacuuming blobs database successful."
|
||||
WriteLog "Vacuum - Vacuum blobs database - PASS"
|
||||
SizeFinish=$(GetSize $CPPL.blobs.db)
|
||||
Output "Vacuuming blobs database successful (Size: ${SizeStart}MB/${SizeFinish}MB)."
|
||||
WriteLog "Vacuum - Vacuum blobs database - PASS (Size: ${SizeStart}MB/${SizeFinish}MB)."
|
||||
else
|
||||
Output "Vaccuming blobs database failed. Error code $Result from Plex SQLite"
|
||||
OutMBput "Vaccuming blobs database failed. Error code $Result from Plex SQLite"
|
||||
WriteLog "Vacuum - Vacuum blobs database - FAIL ($Result)"
|
||||
Fail=1
|
||||
fi
|
||||
@ -764,8 +783,10 @@ do
|
||||
|
||||
# Check main DB
|
||||
if CheckDB $CPPL.db-$TimeStamp ; then
|
||||
SizeStart=$(GetSize $CPPL.db)
|
||||
SizeFinish=$(GetSize $CPPL.db-$TimeStamp)
|
||||
Output "Verification complete. PMS main database is OK."
|
||||
WriteLog "Repair - Verify main database - PASS"
|
||||
WriteLog "Repair - Verify main database - PASS (Size: ${SizeStart}MB/${SizeFinish}MB)."
|
||||
else
|
||||
Output "Verification complete. PMS main database import failed."
|
||||
WriteLog "Repair - Verify main database - FAIL ($SQLerror)"
|
||||
@ -774,8 +795,10 @@ do
|
||||
|
||||
# Check blobs DB
|
||||
if CheckDB $CPPL.blobs.db-$TimeStamp ; then
|
||||
SizeStart=$(GetSize $CPPL.blobs.db)
|
||||
SizeFinish=$(GetSize $CPPL.blobs.db-$TimeStamp)
|
||||
Output "Verification complete. PMS blobs database is OK."
|
||||
WriteLog "Repair - Verify blobs database - PASS"
|
||||
WriteLog "Repair - Verify blobs database - PASS (Size: ${SizeStart}MB/${SizeFinish}MB)."
|
||||
else
|
||||
Output "Verification complete. PMS blobs database import failed."
|
||||
WriteLog "Repair - Verify main database - FAIL ($SQLerror)"
|
||||
@ -878,7 +901,7 @@ do
|
||||
|
||||
for j in "db" "db-wal" "db-shm" "blobs.db" "blobs.db-wal" "blobs.db-shm"
|
||||
do
|
||||
[ -e "$CPPL.$j" ] && mv -f $CPPL.$j "$TMPDIR/$CPPL.$j-ORIG-$TimeStamp"
|
||||
[ -e $CPPL.$j ] && mv -f $CPPL.$j "$TMPDIR/$CPPL.$j-ORIG-$TimeStamp"
|
||||
done
|
||||
WriteLog "Replace - Move Files - PASS"
|
||||
|
||||
|
||||
7
License.md
Normal file
7
License.md
Normal file
@ -0,0 +1,7 @@
|
||||
Copyright (c) 2022, ChuckPa.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to use the Software for personal use only. The Software may not be modified, merged, published, distributed, sublicensed, and/or used in other form without the express written consent of the author.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
56
README.md
56
README.md
@ -1 +1,57 @@
|
||||
# PlexDBRepair
|
||||
|
||||
## Introduction
|
||||
|
||||
DBRepair provides database repair and maintenance for the most common Plex Media Server database problems.
|
||||
|
||||
It is a simple, command line oriented, menu-driven utility.
|
||||
## Situations and errors commonly seen include:
|
||||
|
||||
1. Database is malformed
|
||||
2. Corruption
|
||||
3. Damaged indexes
|
||||
4. Database bloat after optimization
|
||||
|
||||
## Functions provided
|
||||
|
||||
1. Check the databases
|
||||
2. Vacuum the databases
|
||||
3. Reindex the databases
|
||||
4. Repair damaged databases
|
||||
5. Restore databases from most recent backup
|
||||
6. Undo (undo last operation)
|
||||
7. Show logfile of past actions and status
|
||||
|
||||
## Hosts currently supported
|
||||
|
||||
1. ASUSTOR
|
||||
2. Netgear (OS5 Linux-based systems)
|
||||
3. Linux workstation & server
|
||||
4. QNAP (QTS & QuTS)
|
||||
5. Synology (DSM 6 & DSM 7)
|
||||
|
||||
## The menu
|
||||
|
||||
Plex Media Server Database Repair Utility
|
||||
|
||||
|
||||
Select
|
||||
|
||||
1. Check database
|
||||
2. Vacuum database
|
||||
3. Reindex database
|
||||
4. Attempt database repair
|
||||
5. Replace current database with newest usable backup copy
|
||||
6. Undo last successful action (Vacuum, Reindex, Repair, or Replace)
|
||||
7. Show logfile
|
||||
8. Exit
|
||||
|
||||
Enter choice:
|
||||
|
||||
## Exiting
|
||||
|
||||
When exiting, you will be asked whether to keep the interim temp files created during this session.
|
||||
If you've encountered any difficulties or aren't sure what to do, don't delete them.
|
||||
You'll be able to ask in the Plex forums about what to do. Be prepared to present the log file to them.
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user