[TUTO] configure Plex Media Scanner to be "linux runnable" (centos)
Submitted by kacy on
Found this page on Plex Support website
I wanted to improve Plex Refresh mecanism which is not really working, especially when you've just put a new subtitle file for the film you want to see it NOW...
There is command line support (named 'Plex Media Scanner'), but the file is named with multiple space, and it's not really linux friendly ;) So I decided to make small shortcuts, to have those commands usable easily
sudo touch /usr/local/bin/plexmediascanner.sh sudo chmod +x /usr/local/bin/plexmediascanner.sh sudo vi /usr/local/bin/plexmediascanner.sh #!/bin/sh PLEX_RUNNABLE="`which Plex\ Media\ Scanner`" sudo LD_LIBRARY_PATH=${LD_LIBRARY_PATH} -u plex "${PLEX_RUNNABLE}" $@
You can also create one for the server :
sudo touch /usr/local/bin/plexmediaserver.sh sudo chmod +x /usr/local/bin/plexmediaserver.sh sudo vi /usr/local/bin/plexmediaserver.sh #!/bin/sh PLEX_RUNNABLE="`which Plex\ Media\ Server`" sudo LD_LIBRARY_PATH=${LD_LIBRARY_PATH} -u plex "${PLEX_RUNNABLE}" $@
I've also created a small script to have Plex variables online (into profile.d to make things clean) :
sudo touch /etc/profile.d/plex.sh sudo chmod +x /etc/profile.d/plex.sh sudo vi /etc/profile.d/plex.sh #!/bin/sh #set the Plex homedir PLEX_PATH=/usr/lib/plexmediaserver #add Plex homedir to libpath export LD_LIBRARY_PATH=${PLEX_PATH} #add Plex homedir to PATH pathmunge ${PLEX_PATH}
Then you have to edit SUDO config file to allow a simple user to execute the command, or restart Plex service without password, which is done by launching visudo :
Defaults env_keep += "LD_LIBRARY_PATH" Defaults env_keep += "PLEX_PATH" [...] %agroup ALL=(ALL) NOPASSWD: /usr/lib/plexmediaserver/Plex\ Media\ Scanner %agroup ALL=(ALL) NOPASSWD: /sbin/service plexmediaserver*
That's all folks... :D any comments are welcome !