Skip to content

Instantly share code, notes, and snippets.

@babelop babelop/
Last active Dec 16, 2016

What would you like to do?

Plex Automatic Updates (UNIX/RPM)


  1. Create a working directory for your updates, ex: /root/scripts/plex-update/
  2. Download a copy of and make it executable
  3. Find your Plex Token
  4. nano and set the PLEX_TOKEN variable
  5. Test the script ./
  6. Schedule the updates regularly:

Advanced Topics

Monitoring for failed/stuck udpates with an NMS

You can serve status.xml to a local web-server and check its output with a network monitoring system.

cp -av $UPDATE_STATUS_FILE /srv/www/htdocs/ # Optional, for NMS

Use a web-check to search for the string 'size="1"', or alternatively
parse the xml file and use the XPath count(/MediaContainer[@size=1]).

set -e
umask 0002
curl --silent -o $UPDATE_STATUS_FILE "$PLEX_TOKEN"
# cp -av $UPDATE_STATUS_FILE /srv/www/htdocs/ # Optional, for NMS
if [ -n "$(grep notify $UPDATE_STATUS_FILE)" ] ; then
echo "Update available!"
UPDATE_URL=$(grep -oPm1 "(?<=downloadURL=\")[^\"]+" $UPDATE_STATUS_FILE)
if [ -n "$UPDATE_URL" ] ; then
set -x
curl -L -o plex-update.rpm "$UPDATE_URL" && service plexmediaserver stop && rpm -Uvh plex-update.rpm
service plexmediaserver start
set +x
echo "Update finished."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.