A new/revamped bash script to auto-update Plex on the Synology NAS platform

I was actually thinking along those lines as well. It indeed is not fool-proof but what are the odds they’re releasing a new version within 24 hours? Then you can also set the delay to 30 days and it won’t matter.

Though there may be an extra snag, as I was looking at the announcements section and it looks like sometimes things are duplicated in multiple release notes, sometimes they’re not. Also what about Public vs Beta channel? People on the Public channel will only see release notes for versions released there, and if you don’t have a Plex Pass you can’t even check the Plex Pass versions. So there are more caveats here … don’t forget about what you said yourself before about the notifications and perhaps it applies for this too: Priorities! :wink:

LAST CALL! :face_with_tongue:

Really! This will be the last added feature before v3.0.0. I liked @SunMar’s idea of a changelog, so I’ve added one that will be located here:

/Archive/Packages/changelog.txt

Here’s an example of what it looks like:

Version 1.20.1.3252-a78fef9a9 (2020-08-27 06:58:26-07:00)

New Features:
* (Filters) Add 'trash' filter to 'custom filters' (#11103)
* (Library) Store external ids for items in new Plex Movie libraries.

Fixed Features:
* (Analysis) Chapter and index thumbnails would not get re-generated after replacing a file with another with the same filename (#8922)
* (Collections) Setting a collection title or summary to a blank value would make it inaccessible.
* (DVR) Corrected typo in Detect Commercials settings description (#11804).
* (DVR) Fixed an issue where Plex Commercial Skipper would unexpectedly exit with an error code (#11259) (#11151)
* (DVR) Would use excessive amount of memory when loading certain XMLTV guide files (#11501).
* (DVR) server would display incorrect times under "Limit Airing Times To" advance recording option (#11362)
* (EPG) Channel list could fail to load on certain XMLTV guides.
* (Hubs) Some items could show in Continue Watching that fall outside the set window.
* (Intro Detection) Ensure temporary files are always deleted
* (Library) Albums/Artists would default to a reverse alphabetical sort (#11779)
* (Library) Enabling "Include adult content" option for new Plex Movie libraries could result in incorrect matches.
* (Library) Pick up changes to local sidecar subtitles when loading a new Plex Movie item.
* (Library) Renaming files in an upgraded Plex Movie library could result in the user defined poster getting changed.
* (Library) Some sidecar subtitles on new Plex Movie libraries would not get picked up.
* (Metadata) Local assets and metadata for Plex Movie items only read from one location when the item has more than one media version.
* (Scanner) Items unable to match in new Plex Movie libraries would not show the year if available (#11866)
* (Scanner) Show artist and show names in the activity monitor

----------------------------------------

Each version section is divided by a dashed line. Each new version’s info will be added at the top of the file. I’ve also bulleted the lists to make them hopefully easy to follow when the text is subjected to word-wrap.

This should be considered YOUR changelog, not a master changelog for everything Plex. These are the updates that you have downloaded and installed (or were subjected to install but possibly skipped because of the MinimumAge feature) following whichever update channel you are running.

Please let me know what you think so I can finalize the release. Thanks!

1 Like

Just had another idea. :slight_smile: I have a custom scanner and agent installed in my Plex but would like to keep those up-to-date as well. To update them I have written a small script to do the job, but that also meant duplicating the code to figure out the Plex location and after updating restart Plex. But if syno.plexupdate.sh has an option “–post-update-script” that calls the script provided with the option with the Plex folder location as its argument, then that would be killing two birds with one stone. Any output of the script could then be included in the notification as well.

After 3.0 is done with options you already have implemented I could create a PR to also add this “–post-update-script” option, if you think that’s a feature worth having.

I think that after 3.0 everything is going to have to be via GitHub for formality sake.

Out of curiosity right now: Where/when during the update process are you proposing to shim this post-update function?

I was thinking pretty much right after a successful update, then if the update of Plex itself fails for whatever reason, nothing is changed. Though a “pre-update” would work just as well for my use case. As long as it’s after the Plex service is stopped and before it’s started again that works for me :slight_smile:

Just wanted to say thank you so much for putting this script together. I’ve been putting off upgrades for months at a time because it’s such a hassle.

Installed it this afternoon and got it running straight away; although I had to edit the day age variable in the script to 1 since there’s a new version that’s only a day old right now.

1 Like

You’re welcome! I’m very glad to hear it worked well for you!

For anyone still following this thread, the 3.0 update is just about done. Other than being able to pass options/arguments as parameters, the functionality and code are still locked to the commit’d 2.9.9.2 code version. If you are already running 2.9.9.2, it’s not a major functionality change.

I’ve been taking my time a little bit to update the documentation. I figure that after this release development will likely drop-off completely for a lack of need unless something significantly changes at/with Plex or Synology.

2 Likes

Great script, thanks a lot to the author and contributors !
As I understand, this is maintained by the community, not officially, do you confirm ?

Hi @Broffrey, I’m the sole author/maintainer of the script - but I am open to concepts and ideas from the community as long as they fit within the purpose of the script.

Hi,

Today was the first time I ran your script thanks to tasks scheduler. It has failed but it’s not clear at all why. It seemed to be fully downloaded. The only clue I’m considering is a problem of insuficient right on the folder where the script is. But I’m not sure as it runs as “root”.
I don’t the SPK file where the script seems to point.
I got a “289” error number.
I got a DSM notification that packages updates exist when I run script but of course nothing new shows in Package center.
Can I post here the log received by email to troubleshoot it ?
There is a “Plex Token” and I don’t know how this is confidential…

By the way, I noticed the online version check of the script revealed the latest was 2.3.3 whereas the current script version is 2.9.9.2. Else, the script repository needs to be updated, or this is pointing to an obsolete repository :sweat_smile:

This script does not add to or do anything with the DSM Package Center. This script updates Plex independently of it because the DSM Package Center does not update Plex automatically.

The DSM-based notifications are only a hacky way to let you know that things are happening. I’m sure it seems bizarre (as it did with me when I was initially unfamiliar with the situation), but it’s pretty much accepted as the best we can do given the circumstances of not wanting to violate any ‘Terms of Use’ with Synology since we are circumventing the restrictions of the Package Center.

Perhaps @trumpy81 or @ChuckPa can speak more to that from positions of knowledge/familiarity from the Plex-side of things.


Let’s try to get the version confusion out of the way since you are new:

v2.3.3 is the current “release” of the script. In the repository, the current “development” version of the script is 2.9.9.2 and is what is called a “point-release” of fixes, changes, and feature additions leading up to the next expected “release” version of v3.0.0.

v3.0.0 will not contain any new feature that v2.9.9.2 doesn’t already contain. The only difference is that v.3.0.0 accepts command-line arguments for manipulating internal variables.

v2.3.3 should be considered bug-free. If you would like to update to v2.9.9.2 (also considered bug free and part of the reason it’s on hold is to be certain that it is before the next release) for some newer features, you can upgrade to it by manually downloading the latest version of the ‘syno.plexupdate.sh’ file from GitHub. If you run it (as I also run v2.9.9.2 on my NAS), your log file will reflect the following:

       Script: syno.plexupdate.sh v2.9.9.2
   Script Dir: /volume1/homes/admin/scripts/bash/plex/syno.plexupdate
  Running Ver: 2.9.9.2
   Online Ver: 2.3.3
     Released: 2020-09-06 06:34:14-07:00 (62+ days old)

You’ll notice that when you run the script, the log says that the “online” version is 2.3.3. Again, that’s because v2.3.3 is the latest “release” version since the incorporation of what was new features and the fixes of bug subsequently introduced.

You can see the official “releases” for the script, here:

What you otherwise see in the repository is the latest development version of the code.


I would prefer that you post your tech support issue and your log on GitHub so that we don’t muddle this thread with a tech support back-and-forth. But please, do not post your Plex Token anywhere public. Remove/delete/scrub that from any log data you post.

Other than that, I will have a better idea of what you are experiencing once I see your log.

My only thoughts, which are unfortunately to bestow bad news is:

As of DSM 7, none of this is likely to continue to function.

In a nutshell, Synology has decided to take an extremely active and heavy hand in how packages are installed and run as of DSM 7.

Synology has completely revamped how packages work.
A great deal of last minute changes would be in order for them to change their current policy/position on the current direction of DSM 7.

We are jumping through hoops with Synology just to get PMS to run properly

We will know more as we move closer to DSM 7 becoming Release Candidate ready.

1 Like

Users will be prompted though? Syno wont just auto-update boxes to DSM7 overnight?

To my knowledge, it will be just as it was with the DSM 5 -> DSM 6 update.
That said, given how radical the upcoming changes appear to be, anything is possible.

Synology may opt to stop supporting DSM 6 on those systems which are DSM 7-capable. We don’t know what their intentions are at this point.

Oh goodness! Thank you very much for this information. I’ve run it on an HTPC, as well as a Shield, and the Synology has been by far my host.

From myself, and presumably, all of us; thank you for your continued efforts to get Plex to work on the Synology platform.

I hope things end up going easier/better than the expectation :crossed_fingers:

At this point, I can only share that getting PMS running with DSM 7 is proving “challenging”.

  1. We can build the package
  2. We can install the package

We’re likely going to require migrating PMS from the existing storage mechanism to something (as of yet still undefined) new.

1 Like

Hi @michealespinola,
I’ve recently gotten this email notification when the script’s been running, can you help me figure out why the package install failed?


Dear user,

Task Scheduler has completed a scheduled task.

Task: Alternative Plex Update
Start time: Wed, 09 Dec 2020 04:00:02 GMT
Stop time: Wed, 09 Dec 2020 04:00:48 GMT
Current status: 1 (Interrupted)
Standard output/error:

SYNO.PLEX UPDATER SCRIPT v2.9.9.2

       Script: syno.plexupdate.sh v2.9.9.2
   Script Dir: /volume1/docker
  Running Ver: 2.9.9.2
   Online Ver: 2.3.3
     Released: 2020-09-06 14:34:14+01:00 (93+ days old)
             * No new version found.

     Synology: DS918+ (x86_64), DSM 6.2.3-25426 Update 2
     Plex Dir: /volume1/Plex/Library/Application Support/Plex Media Server
   Plex Token:
  Running Ver: 1.21.0.3616-d87012962
   Online Ver: 1.21.0.3711-b509cc236 (Public Channel)
     Released: 2020-12-01 22:19:08+00:00 (7+ days old)
             * Newer version found!

  New Package: PlexMediaServer-1.21.0.3711-b509cc236-x86_64.spk
  Package Age: 7+ days old (7+ required for install)

INSTALLING NEW PACKAGE:
----------------------------------------
2020-12-09 04:00:18 URL:https://downloads.plex.tv/plex-media-server-new/1.21.0.3711-b509cc236/synology/PlexMediaServer-1.21.0.3711-b509cc236-x86_64.spk [111831040/111831040] -> "/volume1/docker/Archive/Packages/PlexMediaServer-1.21.0.3711-b509cc236-x86_64.spk" [1]
package Plex Media Server stop successfully
Failed to install package /volume1/docker/Archive/Packages/PlexMediaServer-1.21.0.3711-b509cc236-x86_64.spk, error = [289]
package Plex Media Server start successfully
----------------------------------------

  Update from: 1.21.0.3616-d87012962
           to: 1.21.0.3711-b509cc236 failed!

If I install the package manually, that works fine. Any clues? Thanks!

Hi @Kynch!

I would normally request that any errors be reported to the GitHub site, but I currently consider this issue a known bug between Plex/Synology, and I think it may deserve visibility here.

error = [289]’ means that the DSM does not trust the security signature of the update attempting to be installed. The seemingly random yet potentially recurring problem is that the Plex ‘Public Key Certificate’ requirement as described at the following link has likely disappeared (potentially temporarily) from your DSM configuration:

This “disappearance” has happened to multiple people seemingly randomly, including myself. The solution is to verify that it is missing, and reinstall it per these instructions:

Pinging @ChuckPa for their thoughts on this from Plex’s perspective. If you or anyone else is interested, there is an on-going issue/discussion about it on the scripts’ GitHub project page here:

2 Likes

If I may inject a bit of advanced info?

  1. DSM 7 changes all this.
  2. Plex no longer uses the “Plex” share in DSM 7
  3. We’ve been so busy with the native DSM 7 app rewrite that we’ve not had time to investigate anything else.
  4. From what I personally do know, Docker & Plex is going to be problematic

Head’s up.