SkillAgentSearch skills...

Syno.plexupdate

A script to automagically update Plex Media Server on Synology NAS

Install / Use

/learn @michealespinola/Syno.plexupdate
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

GitHub release (latest by date) GitHub top language GitHub Donate

 

syno.plexupdate logo

Automatically Update Plex Media Server on the Synology NAS platform

Description

This script addresses common issues with automatically updating Plex on Synology NAS, evolved significantly from the original "martinorob/plexupdate" script. It has been overhauled to eliminate the need for Bash variable editing or SSH access, making it user-friendly for DSM web administration. The original fork from "martinorob/plexupdate" has been discontinued due because the current script was rewritten from the ground up with extensive modifications, resulting in a unique script with different support requirements.

The script is tailored specifically to update the official Synology package of Plex Media Server, as released by Plex GmbH. It uses Synology's built-in tools to automatically detect Plex's installation location, manage updates, and notify the system of any issues. If Plex is properly installed, no manual script editing is needed. The script respects the update channel settings (Public or Beta) configured in your Plex Media Server's 'General' settings.

Though primarily developed and tested on and against a DS1019+, the script is designed and written to work on any compatible Synology platform using DSM's command-line utilities. It reads the local hardware architecture and ensures compatibility with specific versions of Plex that are released for specific Synology hardware platforms. If the update is part of the official Plex public or beta channel, the script will apply it.

By default, the script only installs updates that are at least 7 days old, serving as a stability measure. Additionally, it retains previously downloaded and installed packages in an "Updates" archive for 60 days before automatic deletion to make rollbacks easier to find and perform.

DSM 6 and DSM 7 Support Notes

DSM 7 is officially supported starting from v4.0.0 and the OS platform that the script is developed for. DSM 6 support culminated with the v3.x.x series of the script. Dual support may be considered in the future, but it is not at this time while the code is optimized and stablized for DSM 7, and after some new features are implimented. I welcome development collaboration if anyone is interested, but I do not use DSM 6 myself, so it makes my own work in this direction difficult and undesirable.

How-To Setup Example

1. Save the Script to Your NAS

Download the script and place it into a location of your choosing. As an example, if you are using the "admin" account for system administration tasks, you can place the script within that accounts home folder; such as in a nested directory location like this:

/home/scripts/bash/plex/syno.plexupdate/syno.plexupdate.sh

-or-

/homes/admin/scripts/bash/plex/syno.plexupdate/syno.plexupdate.sh

Note: Synology recommends that you disable the default "admin" account for security reasons. In these examples, the admin directory structure is just a script storage location. You can run the script from here even if you disable the "admin" account (which you really should).

2. Add the Plex 'Public Key Certificate' in DSM 6

  • This step is not required for DSM 7

Updates directly from Plex (which is what this script installs) are not installable in the Synology DSM 6 by default - because no 3rd-party applications are. To install updates directly from Plex, DSM 6 must be configured to allow packages from other trusted application publishers. To facilitate this, Plex's 'Public Key Certificate' must be installed to allow this securely and without simply allowing any and all application publishers to be installable. The full instructions for this can be found on Plex's website here:

https://support.plex.tv/articles/205165858-how-to-add-plex-s-package-signing-public-key-to-synology-nas-package-center/

  1. Download the Plex 'Public Key Certificate' file from here: https://downloads.plex.tv/plex-keys/PlexSign.key
  2. Open the DSM web interface
  3. Open the Package Center
    1. Click the General tab and change the Trust Level to "Synology Inc. and trusted publishers"
    2. Click on the Certificate tab and click the Import button
    3. Supply the location of the downloaded key file and import it
  4. Click OK

3. Setup a Scheduled Task in the DSM

  1. Open the DSM web interface
  2. Open the Control Panel
  3. Open Task Scheduler
    1. Click Create -> Scheduled Task -> User-defined script
    2. Enter Task: name as 'Syno.Plex Update', and leave User: set to 'root'
    3. Click Schedule tab and configure per your requirements
    4. Click Task Settings tab
    5. Enter 'User-defined script' similar to:
      'bash /volume1/homes/admin/scripts/bash/plex/syno.plexupdate/syno.plexupdate.sh'
      ...if using the above script placement example. '/volume1' is the default storage volume on a Synology NAS. You can determine your script directory's full pathname by looking at the Location properties of the folder with the File Station tool in the DSM:
      1. Right-click on the folder containing the script and choose Properties
      2. Copy the full directory path from the Location field
  4. Click OK

Script Logic Flow

  1. Identify the "Plex Media Server" installation directory and other system-specific technical details
  2. Create a "Packages" Archive directory if it does not exist, and remove old update package files
  3. Extract Plex Token from local Preferences file for use to lookup available updates
  4. Scrape JSON data to identify applicable updates specific to hardware architecture
  5. Compare currently running version information against latest online version
  6. If a new version exists and is older than the default 7-days - install the new version
  7. Check if the upgrade was successful, update local changelog if applicable, and send appropriate notifications to the DSM and email (if configured for the DSM)
    • Notifications are only sent when an upgrade installation takes place

Script Directory Structure

The script will automatically create directories and files as needed in the following directory structure based off of the location of the script, as per this example:

/volume1/homes/admin/scripts/bash/plex/syno.plexupdate
|   config.ini
|   README.md
|   syno.plexupdate.sh
|
\---Archive
   +---Packages
   |       changelog.txt
   |       PlexMediaServer-1.21.3.4021-5a0a3e4b2-x86_64.spk
   |       PlexMediaServer-1.21.3.4046-3c1c83ba4-x86_64.spk
   |       PlexMediaServer-1.21.4.4079-1b7748a7b-x86_64.spk
   |       PlexMediaServer-1.22.0.4163-d8c4875dd-x86_64.spk
   |       PlexMediaServer-1.22.1.4228-724c56e62-x86_64_DSM6.spk
   |       PlexMediaServer-1.22.2.4256-1e171f908-x86_64_DSM6.spk
   |       ...
   |
   \---Scripts
            syno.plexupdate.v2.3.1.sh
            syno.plexupdate.v2.3.2.sh
            syno.plexupdate.v2.3.3.sh
            syno.plexupdate.v2.9.9.sh
            syno.plexupdate.v2.9.9.1.sh
            syno.plexupdate.v2.9.9.2.sh
            ...

The Archive directory structure contains copies of update Packages as well as copies of the update Scripts that are running. However, the script archive is not a mirror of what is on GitHub. The script archive are a snapshot of running copies of the script. If you make modifications to the script, the copy in the script archive will be updated accordingly. The packages archive is similarly intended for manual rollback purposes.

The 'changelog.txt' file is a historical changelog only for updates installed locally by the script. It will not contain any historical information for versions that were otherwised skipped by the script.

Example Email Notification

Dear user,

Task Scheduler has completed a scheduled task.

Task: Syno.Plex Update
Start time: Tue, 20 Aug 2024 12:05:36 GMT
Stop time: Tue, 20 Aug 2024 12:06:21 GMT
Current status: 1 (Interrupted)
Standard output/error:

SYNO.PLEX UPDATE SCRIPT v4.4.1 for DSM 7

        Script: syno.plexupdate.sh
    Script Dir: /volume1/homes/admin/scripts/bash/plex/syno.plexupdate
   Running Ver: 4.4.1
    Online Ver: 4.5.0 (59/60)
      Released: 2024-08-20 18:30:14-07:00 (0+ days old)
                * Newer version found!

INSTALLING NEW SCRIPT:
----------------------------------------
2024-08-20 19:09:07 URL:https://raw.githubusercontent.com/michealespinola/syno.plexupdate/v4.5.0/syno.plexupdate.sh [17155/17155] -> "/volume1/homes/admin/scripts/bash/plex/syno.plexupdate/Archive/Scripts/syno.plexupdate.sh" [1]
'/volume1/homes/admin/scripts/bash/plex/syno.plexupdate/Archive/Scripts/syno.plexupdate.sh' -> '/volume1/homes/admin/scripts/bash/plex/syno.plexupdate/Archive/Scripts/syno.plexupdate.sh.cmp
View on GitHub
GitHub Stars375
CategoryDevelopment
Updated3d ago
Forks20

Languages

Shell

Security Score

100/100

Audited on Mar 25, 2026

No findings