Anyone have some input on how to do this? Running the scanner via CLI yields zero output no matter what I try for commands.
I’m not particularly interested in adding third-party, “unsupported” software (ExportTools) to do what is supposed to be available from the base product directly.
Please try sudo -u plex LD_LIBRARY_PATH=/usr/lib/plexmediaserver /usr/lib/plexmediaserver/Plex\ Media\ Scanner --list. This should work. Your current user most likely does not have the read permissions to access the PMS database
I hadn’t considered that I would need to be the “plex” user… I’m running as root, so I have complete admin permissions to the system, but they are apparently inappropriate for the Plex “area”. Thanks for the tip on this. It would be great to get that called out in the linked doc.
Better yet, how about “root” be allowed to run this command?
Ah. My explanation was not 100% correct. Of course, root is allowed. However, the PMS tools look for the PMS database at standard locations in the home of the user that’s currently running the tools. You can overwrite this, e.g. the following command should also work:
Either way, the command-line if you are not currently the plex user is simply too long. It would be more useful to either put that entire ridiculously long command into a script or create a shell for the plex user and su to that account to do these things.
It seems unnecessarily complicated.
Using sudo to run the command as the plex user should not NEED the library path exported since that user’s home directory is set to that path.
How does one redirect the output to a text file? Using the standard “> filename.txt” after the command does not work, and I’m wondering if this is because the command is running in the userspace of a different user and the standard out is redirected to the root user but won’t redirect beyond that.
Redirecting either STDOUT -OR- STDERR does nothing. Attempting to do a regular redirect or use of the pipe to an output “capture” process does not work. So, while I can appreciate that you’re “not here to teach me linux”, I need to understand exactly how these utilities, written by the Plex team, are coded to provide their output so that I can capture it properly.
For what it’s worth, the information on the actual Plex pages doesn’t even cover this AND the information on third-party web sites that covers this ALSO does not work. The examples that ARE given on third-party sites are for the Windows binaries and use standard redirection techniques. That tells me that there’s something different about how the Linux binaries are built, OR it’s a permissions thing (just like not being able to run the commands as the superuser).
Could you for a start name you OS and environment, so we might be able to reproduce?
And as the author of ExportTools, I kinda fail to see your point here, since as a Linux dude, you most likely use 3.Party Open Source all the time, and that’s what ExportTools is!
Also note, that ExportTools do not hammer on your PMS, but do paging requests, but the CLI tool you try to use, and btw works perfectly for me, will hammer on the PMS!
I use OpenSUSE. I currently have a LEAP 42.3 and a LEAP 15.0 system that are behaving exactly the same way. And, while I do use open source tools quite a bit, I try very hard to limit myself wherever I can to those that are part of regular update channels and similar. And, in this case, this is a “one and done” effort for me to compare lists between two servers so I can finish sync’ing the content between them that I want sync’ed and then it won’t get used again.
If I can’t get the stock Plex tools to work, I’ll just use “find” or similar to create the text files of the filenames and go from there. I was hoping to be able to get a little bit of the additional info about the media at the same time, but the one thing that really matters to me is the file size. I can get that with find.
Again, just trying to use the stock tools instead of having to do an end-around.
It -has- to be run as the Plex user, however, or it outputs nothing to STDOUT or STDERR.
The way I run my machines is that I shell into them as a standard user, issue the command “su -” to get the full root user’s environment, and then run the commands with the sudo wrapper to run as the plex user.
I’m going to try again using only the “su” by itself in case grabbing the super user’s full environment is causing a problem. I’m also going to try permitting my standard user id to issue that command as the plex user to see what THAT might do. It’s possible there are some shell incompatibilities going on here, but the CLI utils really shouldn’t get tripped up by that… no other utils do.
Piping the output to a file in the current directory, even though I am the root user, simply doesn’t work. I -HAVE- to pipe the output to a file within the root user’s home directory. This makes absolutely no sense to me whatsoever.