mirror of
https://github.com/ChuckPa/PlexDBRepair.git
synced 2025-11-05 18:58:53 -05:00
May 2025 cleanup
Minor DB Cleanup extras.
This commit is contained in:
parent
e2a3d1d04b
commit
a34511a219
43
DBRepair.sh
43
DBRepair.sh
@ -2,12 +2,12 @@
|
||||
#########################################################################
|
||||
# Plex Media Server database check and repair utility script. #
|
||||
# Maintainer: ChuckPa #
|
||||
# Version: v1.10.03 #
|
||||
# Date: 17-Mar-2025 #
|
||||
# Version: v1.10.05 #
|
||||
# Date: 20-May-2025 #
|
||||
#########################################################################
|
||||
|
||||
# Version for display purposes
|
||||
Version="v1.10.03"
|
||||
Version="v1.10.05"
|
||||
|
||||
# Have the databases passed integrity checks
|
||||
CheckedDB=0
|
||||
@ -976,6 +976,9 @@ DoRepair() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Temporary DB actions
|
||||
"$PLEX_SQLITE" $CPPL.db "DELETE from statistics_bandwidth where account_id is NULL;"
|
||||
|
||||
# Continue
|
||||
Output "Exporting current databases using timestamp: $TimeStamp"
|
||||
Fail=0
|
||||
@ -2098,7 +2101,6 @@ do
|
||||
fi
|
||||
;;
|
||||
|
||||
|
||||
# Vacuum
|
||||
4|vacu*)
|
||||
|
||||
@ -2268,6 +2270,39 @@ do
|
||||
WriteLog "Prune - PASS"
|
||||
;;
|
||||
|
||||
|
||||
# Records count
|
||||
30|coun*)
|
||||
|
||||
Temp="$DBDIR/DBRepair.tab1"
|
||||
Temp2="$DBDIR/DBRepair.tab2"
|
||||
|
||||
# Ensure clean
|
||||
rm -f "$Temp" "$Temp2"
|
||||
|
||||
# Get list of tables
|
||||
Tables="$("$PLEX_SQLITE" "$DBDIR/com.plexapp.plugins.library.db" .tables | sed 's/ /\n/g')"
|
||||
|
||||
# Separate and sort tables
|
||||
for i in $Tables
|
||||
do
|
||||
echo $i >> "$Temp"
|
||||
done
|
||||
sort < "$Temp" > "$Temp2"
|
||||
|
||||
Tables="$(cat "$Temp2")"
|
||||
|
||||
# Get counts
|
||||
for Table in $Tables
|
||||
do
|
||||
Records=$("$PLEX_SQLITE" "$DBDIR/com.plexapp.plugins.library.db" "select count(*) from $Table;")
|
||||
printf "%36s %-15d\n" $Table $Records
|
||||
done
|
||||
|
||||
# Cleanup
|
||||
rm -f "$Temp" "$Temp2"
|
||||
;;
|
||||
|
||||
# Ignore/Honor errors
|
||||
42|igno*|hono*)
|
||||
|
||||
|
||||
@ -8,6 +8,11 @@
|
||||

|
||||
|
||||
# Release Info:
|
||||
v1.10.05
|
||||
|
||||
1. DB Cleanup - Temporary assist with PMS database cleanups
|
||||
2. Record Count report - Report the number of records in each main DB table. (Monitoring growth)
|
||||
|
||||
v1.10.03
|
||||
|
||||
1. LC_ALL - When LC_ALL="", set LC_ALL=C (MacOS now needs this)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user