A user might want to auto repair then include (merge) watch history.
“Auto” isn’t at the sophistication (automation) level I want.
It was created with the plan to have a DBRepair.conf (config) file.
None of that ever worked as intended but by that time, the popularity mandated I keep the commands as they were.
@ChuckPa
Not that I need the script now but maybe you should add another information to the tutorial on GitHub.
On the bottom of the tutorial by the chapter DSM 7 - Step 2 - Run DBRepair as the designated username you write: make sure it is executable.
I think it could be helpful to add a short tutorial how you make it executable (what steps would be necessary here) and/or how to check if it is. (I personally would have no clue how to do this)
In all cases on Unix & Linux hosts, as I show the commands.
Granted it takes a few extra steps if you are afraid of using SSH / Putty into the Syno.
The general form is always:
sudo bash <---- Elevate to administrator (root) privilege)
cd /path/to/DBRepair.tar_dir <---- change to directory where DBRepair.tar is
tar xf DBRepair-x.y.z.tar.gz <---- Extract the tar file to get all the pieces out
cd DBRepair-x.y.z <--- Get into the subdirectory where DBRepair.sh is
chmod +x DBRepair.sh <--- Give it execute permission
./DBRepair.sh stop auto start exit <--- Run it
Got it!
Sorry, I was a bit confused first because I thought “executable” has something to do with the file permission checkboxes on DSM. But this make sense now.
Environment Variables
DBRepair now supports the use of environment variables to allow customization of some operations.
WARNING: Use of these variables may adverse impact PMS operation or performance. USE WITH CAUTION.
DBREPAIR_CACHEAGE - Specify the maximum age for PhotoTrancoder Cache images to be retained
Default DBREPAIR_CACHEAGE is set at 30 days.
You may override this by setting DBREPAIR_CACHEAGE=N, where N is the number of days worth of cache image you wish to retain.
When using interactively, DBRepair will prompt you to confirm OK to remove and show you the cache age
Example: export DBREPAIR_CACHEAGE=20
Enter command # -or- command name (4 char min) : remove
Counting how many files are more than 20 days old.
OK to prune 4497 files? (Y/N) ?
Works fine on my N100/Ubuntu 24.04 box.
I used Settings → server_name → General + Remove to remove the server from my account.
I then ran the script and it reclaimed the server.
User Credential Reset output
$ sudo ./UserCredentialReset.sh claim-JJ7HzpzsNZgadY4Mxu9-
User credential reset & reclaim tool for Plex Media Server (Linux) (Ubuntu 24.04.3 LTS)
(Version: v1.11.0)
This utility will reset the server's credentials.
It will next reclaim the server for you using a Plex Claim token you provide from https://plex.tv/claim
Using given claim token: 'claim-JJ7HzpzsNZgadY4Mxu9-'
Stopping PMS
Clearing Preferences.xml
Getting new credentials from Plex.tv
Claim completed without errors.
Username: FordGuy61
Email: <redacted>
Starting PMS
Complete.
$
Although the README mentions MacOS might have been supported through manual location of the Preferences.xml file, it won’t work for a modern MacOS which has too many unique behaviors, different command arguments for stat and sed, and no Preferences.xml like we have on Linux.
It looks like PMS stores its config for MacOS in com.plexapp.plexmediaserver.plist
that’s no longer human readable.
The user has to modify it using the Defaults(1) command.
I found a GUI client works well for resetting as described in the Plex Support docs, but I wanted to say nice job on the shell utility. It was a pleasure to read, and have a nice weekend
Since “DeflateGate” is still lingering…
and I’ve learned what’s needed for bandwidth_statistics to continue to function,
I’ve prototyped DBRepair v1.12.00
The text it current outputs feels “off”
(Auto & Deflate should, imho, be mostly similar as they are 3-step processes)
I need help with how to fix the working. May I ask your input please ?
21 - 'prune' - Remove old image files (jpeg,jpg,png) from PhotoTranscoder cache & all temp files left by PMS.
22 - 'purge' - Remove unused temp files.
23 - 'deflate' - Deflate a bloated PMS main database.
42 - 'ignore' - Ignore duplicate/constraint errors.
88 - 'update' - Check for updates.
98 - 'quit' - Quit immediately. Keep all temporary files.
99 - 'exit' - Exit with cleanup options.
Enter command # -or- command name (4 char min) : 23
Automatic Check and Deflate started.
Checking the PMS databases
Check complete. PMS main database is OK.
Check complete. PMS blobs database is OK.
Backup current databases with '-BACKUP-2025-10-04_02.15.41' timestamp.
Starting Deflate. (There will be no output until complete.)
PMS main database successfully repaired.
Reducing main database size.
PMS main database size reduced.
Verifying PMS main database.
Verification complete. PMS main database is OK. New size = 206 MB
PMS main database deflate completed.
Saving current main database with '-BLOATED-2025-10-04_02.15.41'
Making deflated database active
Deflate complete. Please check your library settings and contents for completeness.
Deflate successful.
Recommend running Auto next to complete optimization of new database.
Select
1 - 'stop' - (Not available. Stop manually.)
2 - 'automatic' - Check, Repair/Optimize, and Reindex Database in one step.
This example did a full check of a 31 GB DB, and reduced it in 12 minutes.