Why can't I use the media scanner from the command line?

I want to use the Plex Media Scanner from the command line but it won’t show me anything about my library:

trolley@mediaserver:~$ /usr/lib/plexmediaserver/Plex\ Media\ Scanner --list
trolley@mediaserver:~$

I have modifed the startup scripts so the server is running as my user, so I know that’s not the problem (I found that solution already):

trolley@mediaserver:~$ ps aux | grep "Plex Media Server"
trolley   1250  0.0  0.0   4496   716 ?        Ss   19:16   0:00 /bin/sh -c LD_LIBRARY_PATH=/usr/lib/plexmediaserver "/usr/lib/plexmediaserver/Plex Media Server"
trolley   1257  0.1  2.3 444276 93064 ?        Sl   19:16   0:01 /usr/lib/plexmediaserver/Plex Media Server

Is there something else I’m missing?

It’s username sensitive. It must be run as user plex

OK, thanks. It turns out changing which user PMS ran as wasn’t as simple as I thought since my changes got clobbered by a server upgrade.

I’ll have to figure out how to run my scripts as the plex user instead.

Why is there an option in /etc/defaults/plexmediaserver to change it then (which didn’t work on Ubuntu anyway)?

Since Ubuntu 16.04, when systemd was implemented, /etc/defaults was obsoleted. It is provided in the package now for backward compatibility with Ubuntu 14 and 15 plus other init based systems.

I have a Linux Tip which shows you how to customize your Plex installation which will endure server upgrades.

replace

/usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan

with

su plex -c “/usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan”

2 Likes