Script to Auto Update Plex on Synology nas [rev6]

@monkeyhat and @trent.curtis

Replace this line:

TOKEN=$(cat /volume1/Plex/Library/Application\ Support/Plex\ Media\ Server/Preferences.xml | grep -oP 'PlexOnlineToken="\K[^"]+')

With the following:

PMS_PATH=$(find / -path '*/Plex Media Server' -print -quit 2>/dev/null)
TOKEN=$(grep -Po 'PlexOnlineToken="\K[^"]+' "${PMS_PATH}"/Preferences.xml)

And replace the following if block:

  if [ "$CPU" = "x86_64" ] ; then
    URL=$(echo $JSON | jq -r ".nas.Synology.releases[1] | .url")
  else
    URL=$(echo $JSON | jq -r ".nas.Synology.releases[0] | .url")
  fi

With this:

URL=$(echo "${JSON}" | jq -r '.nas.Synology.releases[] | select(.build=="linux-'"${CPU}"'") | .url')
2 Likes