Once upon a time, during the dark ages, we had to run several shell commands–like savages–to get the Plex plugin in TrueNAS (or FreeNAS, if you go back that far) to update. One had to fetch, then unpack the tarball, then move to the right directory, change ownership, and finally run the script! It was quite a pain when Plex was coming out with a new update every week (or so it seemed), and got to be more annoying than productive.
Fortunately, we don’t have to live like animals anymore because [mstinaff] wrote a nice, simple shell script to take care of all the heavy lifting! You can even set it up as a cron task to run on schedule (for when Plex decides to start issuing updates every few days again).
Let’s start by assuming that you know how to access your TrueNAS jails. On the Jails dialog, open Plex, then DO NOT CLICK “Update”. Click “Shell”.Once you’ve got your root prompt in the shell, download the updater by invoking the following command:
From here, you can just run the shell script with
Automating Plex updates on TrueNAS with cron jobs
To set up a cron job on your TrueNAS installation, navigate to the Tasks > Cron Jobs dialog. Click the “ADD” button to create a new cron job and give it a descriptive name such as “Plex update”. Then, enter the following in the “Command” field:
/usr/local/bin/iocage exec [plexjail] /bin/sh /usr/local/PMS_Updater/PMS_Updater.sh -r -a -v
Substitute the name of your Plex jail for
[plexjail]. Mine is just called “
-r flag will keep your installation clean by removing the older packages before installing the new one. The
-a flag automatically updates to the newest version without user intervention. Finally, the
-v flag runs the script in verbose mode, so you’ll have a log available just in case anything goes wrong.
Set the “Run As User” field to root, and set your preferred schedule. I run mine weekly on Sunday nights. From here, make sure your job is enabled, and click “SAVE”. Now, you shouldn’t have to make another manual Plex update again!