DBRepair development

Me? Write an app?

The logistic support nightmares could pretty much ruin doing it for the enjoyment.
:see_no_evil:

Would it be nice if PMS had this sort of thing Built-In ?? OH HECK YES.

It’s been requested many times but … and why this script came into being.

Let’s ask the honest question

  1. How many platforms would I need to support ?
    – X86_64
    – X86 ??
    – ARMv8
    – ARMv7 ??

  2. OS’s
    – Linux
    – Windows (someone will need to help with that. )
    – MacOS (someone will need to do that)

  3. Which executable style?
    – AppImage ?
    – Standalone ? (one native per host type – this is the scary part)

My shell script, having been restructured, lends itself to porting to C.
Part of the reason I restructured it was to look forward toward native / compiled apps.

I’m open to input.
Thoughts / suggestions ?

If I had to do it… probably a golang backend to exec the db repairs (can be compiled for all those platforms/os’s) and an electron front end (go-astilectron?) if you need a cross platform UI. For users/platforms without a UI the golang portion could also support a command line interface similar to what you have now with the scripts as well. ¯\_(ツ)_/¯

At this point I’m about to burn out this bloody Mac Mini, bury it at a crossroads, and salt the earth over it.

Can’t get the sodding utility to run.

I have no issues with it.

bash-3.2# ./DBRepair.sh 
 
 
 
      Plex Media Server Database Repair Utility (Mac)
                       Version v1.0.3
 

Select

  1 - 'stop'      - (Not available. Stop manually)
  2 - 'automatic' - database check, repair/optimize, and reindex in one step.
  3 - 'check'     - Perform integrity check of database
  4 - 'vacuum'    - Remove empty space from database
  5 - 'repair'    - Repair/Optimize  databases
  6 - 'reindex'   - Rebuild database database indexes
  7 - 'start'     - (Not available. Start manually)

  8 - 'import'    - Import watch history from another database independent of Plex. (risky)
  9 - 'replace'   - Replace current databases with newest usable backup copy (interactive)
 10 - 'show'      - Show logfile
 11 - 'status'    - Report status of PMS (run-state and databases)
 12 - 'undo'      - Undo last successful command

 99 -  exit

Enter command # -or- command name (4 char min) : 

As I said, very obvious PEBKAC here…and I don’t know how to sort this.

I’m now completely stumped. I’ve managed to change directories. DBrepair.sh is extracted. I should be able to run this directly with the chmod command, correct?

Yet it comes back with “incompatible system” and a list of what it’ll run on. Plex is stopped, by the way. OS is Monterey.

@wyldemusick

When you go to the releases endpoint.

You see the v1.0.4.tar.gz
When you tar xf v1.0.4.tar.gz you will get a PlexDBRepair-1.0.4/ directory

Now follow along in my console session here. ( I copy from my Linux machine to my Mini (easier for me)

[chuck@lizum tmp.2012]$ scp v1.0.4.tar.gz  chuck@mini:/Users/chuck
v1.0.4.tar.gz                                                                                 100%   22KB   7.7MB/s   00:00    
[chuck@lizum tmp.2013]$ ssh mini
Last login: Thu Apr 13 16:15:55 2023 from 192.168.0.13
chuck@mini ~ % ls
Applications	Desktop		Downloads	Movies		Pictures	certtest	ucr.sh
DBRepair.sh	Documents	Library		Music		Public		glock		v1.0.4.tar.gz
chuck@mini ~ % tar xf v1.0.4.tar.gz 
chuck@mini ~ % ls -la
total 232
drwxr-x---+ 26 chuck  staff    832 Apr 13 16:16 .
drwxr-xr-x   5 root   admin    160 Jan 11 02:03 ..
-r--------   1 chuck  staff      7 Dec 11 21:09 .CFUserTextEncoding
-rw-r--r--@  1 chuck  staff  10244 Feb 28 21:36 .DS_Store
drwx------+  7 chuck  staff    224 Apr 10 01:08 .Trash
drwxr-xr-x  11 chuck  staff    352 Apr  5 16:57 .anydesk
-rw-------   1 root   staff   1069 Apr 13 16:08 .bash_history
-rw-------   1 chuck  staff     34 Mar 16 01:29 .lesshst
drwx------   5 chuck  staff    160 Mar  1 01:11 .ssh
-rw-------   1 chuck  staff   2104 Apr 13 16:15 .zsh_history
drwx------   5 chuck  staff    160 Apr 10 01:07 .zsh_sessions
drwx------@  3 chuck  staff     96 Dec 12 16:44 Applications
-rwxr-xr-x   1 chuck  staff  50712 Apr 10 00:59 DBRepair.sh
drwx------+  5 chuck  staff    160 Dec 12 01:51 Desktop
drwx------+  3 chuck  staff     96 Dec 11 21:08 Documents
drwx------+ 10 chuck  staff    320 Apr  5 16:56 Downloads
drwx------@ 82 chuck  staff   2624 Apr  5 16:51 Library
drwx------   5 chuck  staff    160 Apr  5 16:56 Movies
drwx------+  4 chuck  staff    128 Dec 11 21:24 Music
drwx------+  4 chuck  staff    128 Dec 11 21:09 Pictures
drwxr-xr-x   8 chuck  staff    256 Apr  1 17:27 PlexDBRepair-1.0.4
drwxr-xr-x+  4 chuck  staff    128 Dec 11 21:08 Public
drwxr-xr-x   8 chuck  staff    256 Apr  5 17:13 certtest
drwxr-xr-x   2 root   staff     64 Apr 10 01:12 glock
-rwxr-xr-x   1 root   staff  10422 Dec 22 16:11 ucr.sh
-rw-r--r--   1 chuck  staff  23024 Apr 13 16:16 v1.0.4.tar.gz
chuck@mini ~ % cd PlexDBRepair-1.0.4 
chuck@mini PlexDBRepair-1.0.4 % ls -la
total 240
drwxr-xr-x   8 chuck  staff    256 Apr  1 17:27 .
drwxr-x---+ 26 chuck  staff    832 Apr 13 16:16 ..
-rw-r--r--   1 chuck  staff   6303 Apr  1 17:27 DBRepair-Windows.bat
-rw-r--r--   1 chuck  staff   1612 Apr  1 17:27 DBRepair-Windows.zip
-rwxr-xr-x   1 chuck  staff  50712 Apr  1 17:27 DBRepair.sh
-rwxr-xr-x   1 chuck  staff    965 Apr  1 17:27 License.md
-rw-r--r--   1 chuck  staff  24729 Apr  1 17:27 README.md
-rw-r--r--   1 chuck  staff  24244 Apr  1 17:27 ReleaseNotes
chuck@mini PlexDBRepair-1.0.4 % chmod +x DBRepair.sh
chuck@mini PlexDBRepair-1.0.4 % sudo ./DBRepair.sh 
Password:
grep: /proc/1/cgroup: No such file or directory
grep: /proc/1/cgroup: No such file or directory
grep: /proc/1/cgroup: No such file or directory
 
 
 
      Plex Media Server Database Repair Utility (Mac)
                       Version v1.0.3
 

Select

  1 - 'stop'      - (Not available. Stop manually)
  2 - 'automatic' - database check, repair/optimize, and reindex in one step.
  3 - 'check'     - Perform integrity check of database
  4 - 'vacuum'    - Remove empty space from database
  5 - 'repair'    - Repair/Optimize  databases
  6 - 'reindex'   - Rebuild database database indexes
  7 - 'start'     - (Not available. Start manually)

  8 - 'import'    - Import watch history from another database independent of Plex. (risky)
  9 - 'replace'   - Replace current databases with newest usable backup copy (interactive)
 10 - 'show'      - Show logfile
 11 - 'status'    - Report status of PMS (run-state and databases)
 12 - 'undo'      - Undo last successful command

 99 -  exit

Enter command # -or- command name (4 char min) : 

Not snark: thank you for treating me like a particularly slow marmoset, as I think I see where my denseness has been munging things.

Witness:

I’ll try this. Doubtless feeling foolish as I do, but if it gets the job done and I learn something that’ll stick, it’s all good.

I swear, though, I’m not actually this big of an idiot.

WTH ?

which version of the script? (look at the first few lines of the SH file)

I’ve not updated the OS yet (not sure how far I can go)

chuck@mini ~ % uname -a
Darwin mini.local 21.6.0 Darwin Kernel Version 21.6.0: Mon Dec 19 20:44:01 PST 2022; root:xnu-8020.240.18~2/RELEASE_X86_64 x86_64
chuck@mini ~ %

1.04, and downloaded direct from the repository.

I just followed your walkthrough. It didn’t work, even with sudo.

At this point I’m beginning to think I have a demon Mac.

I’m on a late 2014 Mini. Monterey is the last upgrade for this box.

What’s confusing me is that others with this configuration are running the script fine.

That’s exactly what you see here. This box is running OCLP booted Monterey
(a 6,2 model)

I’m baffled.

Last thought I have…

Is your PMS installed in the default location under

~/Library/Application Support/Plex Media Server ?

Friend of mine in Australia just followed this guide to install Ventura on a 2012 MacBook Pro, in case you want to have sone excitement.

Installing Ventura on an unsupported Mac.

It is. It’s almost the only thing on there (I also have Filebot and MusicBrainz Picard installed), and I’ve never altered the default locations for anything I’ve installed.

This is the last set of logs I was able to pull from Littlemac.

Plex Media Server Logs_2023-04-11_10-04-58.zip (4.6 MB)

Stap me vitals, lads! It’s up again, so I grabbed the latest logs.

Should I grab the database files and send you a link once I get them on Google Drive?
Plex Media Server Logs_2023-04-13_19-59-16.zip (4.7 MB)

You didn’t tell me… where’s it installed ?

Can you see that path as valid?

As for your overall configuration – needs fixing.

Apr 13, 2023 18:43:55.261 [0x700002363000] DEBUG - Detected primary interface: 192.168.0.113
Apr 13, 2023 18:43:55.261 [0x700002363000] DEBUG - Network interfaces:
Apr 13, 2023 18:43:55.261 [0x700002363000] DEBUG -  * 1 lo0 (127.0.0.1) (00-00-00-00-00-00) (loopback: 1)
Apr 13, 2023 18:43:55.261 [0x700002363000] DEBUG -  * 1 lo0 (::1) (00-00-00-00-00-00) (loopback: 1)
Apr 13, 2023 18:43:55.261 [0x700002363000] DEBUG -  * 4 en0 (2600:8800:7100:cb:1077:19be:998b:f040) (0C-4D-E9-C9-A7-7F) (loopback: 0)
Apr 13, 2023 18:43:55.261 [0x700002363000] DEBUG -  * 4 en0 (192.168.0.113) (0C-4D-E9-C9-A7-7F) (loopback: 0)
Apr 13, 2023 18:43:55.261 [0x700002363000] DEBUG -  * 5 en1 (192.168.0.149) (6C-40-08-91-FA-1A) (loopback: 0)
Apr 13, 2023 18:43:55.261 [0x700002363000] DEBUG -  * 5 en1 (2600:8800:7100:cb:890:5183:f9ba:7934) (6C-40-08-91-FA-1A) (loopback: 0)
Apr 13, 2023 18:43:55.263 [0x700002363000] DEBUG - Creating NetworkServices singleton.
Apr 13, 2023 18:43:55.263 [0x700002363000] DEBUG - NetworkServices: Initializing...

Two adapters on the same LAN subnet - Not good for Plex.
ALWAYS recommend bonding them into one IP address.

Re: my development mini – Not going to touch it. I’m going to wait until OCLP has all the quirks worked out – AND – need exists to update. My tool is shell script. It should be fine on any supported release.