Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

Updating Plex on FreeNAS 11.1-U6

Joined
Aug 15, 2014
Messages
51
Thanks
0
#1
I'm running Plex 1.14.1.5488 in a Warden jail mainly because I don't yet want to make the jump to 11.2. The last time that I updated and tried to run the PMS_Updater script it killed my Plex install and I had to revert back to the old script and then manually install the version of Plex that I'm running to get things back to functionality again. I've kind of just let it be since then.

My goal is a general overview of what I'd need to do to keep my current Jail functional and updated without going to iocage or 11.2 at the moment.

If anyone has any insight it would be appreciated.

Thanks!
 
Joined
Feb 9, 2015
Messages
32
Thanks
2
#2
I made some updates to that script, but I've only tested it on an iocage jail. Can you save your environment and give this one a try?

https://raw.githubusercontent.com/jbeez/PMS_Updater/TokenAuth/PMS_Updater.sh

I don't have access to a warden jail, but it expects things to be in certain places. Your plex preferences file should be in
/Plex\ Media\ Server/Preferences.xml
and your plexmediaserver install directory should be in /usr/local/share/ if not you should be able to adjust those paths at the top of the script.
 
Joined
Aug 15, 2014
Messages
51
Thanks
0
#3
So this Plex jail has existed and been upgraded for many years starting from the old plugin and I never really took the time to dig into how it all worked or where anything was installed. The PMS_Updater script just worked and everything was fat, dumb, and happy until it wasn't.

Digging into it, I believe my install directory is usr\pbi\plexmediaserver-amd64 and I'm working on finding my preferences.xml file now.
 
Joined
Aug 15, 2014
Messages
51
Thanks
0
#4
Yeah so from my current "working" PMS_Updater script
Code:
URLBASIC="https://plex.tv/api/downloads/1.json"
URLPLEXPASS="https://plex.tv/api/downloads/1.json?channel=plexpass"
DOWNLOADPATH="/tmp"
LOGPATH="/tmp"
LOGFILE="PMS_Updater.log"
PMSPARENTPATH="/usr/pbi/plexmediaserver-amd64/share"
PMSLIVEFOLDER="plexmediaserver"
PMSBAKFOLDER="plexmediaserver.bak"

There's not even any reference in the script to preferences.xml at all.
 
Joined
Aug 15, 2014
Messages
51
Thanks
0
#5
I found it and looks like it lives at var\db\plexdata\Plex Media Server

Timestamp on that xml file is from today so it's gotta be the one. I'm going to snapshot this jail and edit your script with these locations and then cross my fingers and report back afterwards.
 
Joined
Feb 9, 2015
Messages
32
Thanks
2
#6
Just to add I run this inside of the iocage jail not on the host freenas install. Are you running it in the jail or above on the host?
 
Joined
Aug 15, 2014
Messages
51
Thanks
0
#7
Yes I run this script from within the Plex Jail, not on the host.

Odd issue I'm running into. I renamed my old script file to PMS_Updater.sh.old and then created a new file named PMS_Updater.sh with your script in it with the bits edited in regard to where my install is. I set permissions on this file to 0755 and verified the permissions. I cannot run the new script, however the old one will still run. Below is my output of ls -la on this file.

Code:
-rwxr-xr-x  1 root  wheel  8902 Jul 12 12:36 PMS_Updater.sh
 
Joined
Feb 9, 2015
Messages
32
Thanks
2
#8
I can tell you this, I changed the script to use the python that ships with Plex instead of perl5, and I leverage wget instead of perl. Can you paste the section with the variables up top where you changed the paths?
 
Joined
Aug 15, 2014
Messages
51
Thanks
0
#9
Code:
PLEXTOKEN="$(sed -n 's/.*PlexOnlineToken="//p' /var/db/plexdata/Plex\ Media\ Server/Preferences.xml | sed 's/\".*//')"
BASEURL="https://plex.tv/api/downloads/5.json"
TOKENURL="$BASEURL?channel=plexpass&X-Plex-Token=$PLEXTOKEN"
DOWNLOADPATH="/tmp"
LOGPATH="/tmp"
LOGFILE="PMS_Updater.log"
PMSPARENTPATH="/usr/pbi/plexmediaserver-amd64/share"
PMSPATTERN="PlexMediaServer-[0-9]*.[0-9]*.[0-9]*.[0-9]*-[0-9,a-f]*-FreeBSD-amd64.tar.bz2"


Oh and by the way thanks for all your help with this!
 
Joined
Aug 15, 2014
Messages
51
Thanks
0
#10
Code:
root@plexmediaserver_3:/ # ./PMS_Updater.sh -v -a
./PMS_Updater.sh: Command not found.


Also that is my output when attempting to run the new script. It behaves as if permissions are not set properly though they are.
 
Joined
Feb 9, 2015
Messages
32
Thanks
2
#11
This needs three things to work.
The sh binary path needs to work as the top line in the file.
It needs fetch working. Can you run fetch by itself does that work?
It needs to run the Plex Script Host file in the Plex installation directory.

On my iocage install it kept the Plex installation away from where the Preferences file was. Sorry not at a computer right now. Can you check those?
 
Joined
Feb 9, 2015
Messages
32
Thanks
2
#12
Can you show me an ls -al output of your pmsparentpath directory?
 
Joined
Aug 15, 2014
Messages
51
Thanks
0
#13
Code:
root@plexmediaserver_3:/usr/pbi/plexmediaserver-amd64/share # ls -la
total 65
drwxr-xr-x   16 root  wheel   17 Mar 19 14:07 .
drwxr-xr-x   17 root  wheel   27 Jul 31  2015 ..
drwxr-xr-x    2 root  wheel    2 Jun 26  2015 aclocal
drwxr-xr-x    2 root  wheel    2 Jun 26  2015 applications
drwxr-xr-x    2 root  wheel    2 Jun 26  2015 dict
lrwxr-xr-x    1 root  wheel   22 Jul 31  2015 icons -> /usr/local/share/icons
drwxr-xr-x    3 root  wheel    3 Jun 26  2015 java
drwxr-xr-x   14 root  wheel   14 Jun 26  2015 licenses
drwxr-xr-x   90 root  wheel   90 Jun 26  2015 locale
drwxr-xr-x    2 root  wheel    2 Jun 26  2015 misc
drwxr-xr-x  152 root  wheel  152 Jun 26  2015 nls
drwxr-xr-x    2 root  wheel    2 Jun 26  2015 pixmaps
drwxr-xr-x    4 root  wheel   59 Mar 19 14:07 plexmediaserver
drwxr-xr-x    4 root  wheel   59 Mar 19 14:04 plexmediaserver.bak
drwxr-xr-x    2 root  wheel    2 Jun 26  2015 sgml
drwxr-xr-x    2 root  wheel    2 Jun 26  2015 skel
drwxr-xr-x    2 root  wheel    2 Jun 26  2015 xml


The #!/bin/sh line at the top of the file is the same in my old script that runs.

Fetch runs and executing fetch returns usage arguments.
 
Joined
Feb 9, 2015
Messages
32
Thanks
2
#14
Is there a Plex Script Host inside that plexmediaserver directory?

Also in the same plexmediaserver dir, is there a Resources/Python directory path?
 
Joined
Feb 9, 2015
Messages
32
Thanks
2
#16
Where on the jail filesystem is the script? Maybe it’s mounted no execute where it’s sitting rn? Running out of ideas :)

I did have a version of the script on my github that runs on the host but it’s an older revision and uses iocage commands it would need to be modified to run jexec commands
 
Top