Thanks for this! I have been looking to do something like this for a while.
Ref Email notifications that were asked about, Synology Task Scheduler allows for enabling notifications via email either on completion of script. Could get a bit much getting an email every day though? I have set this script to run once a week with notifications on which is suitable for me.
cat /volume2/Plex/Library/Application\ Support/Plex\ Media\ Server/Preferences.xml | grep PlexOnlineToken | awk -F'"' '{ print $26 }'
is just echoing “2” for me and not my token.
I was linked to this by a friend as well as being shown on my Google Now feed, thank you @Martino!
It looks like its running just fine on my Synology DS1019+, but I set the task to disabled for now until the next PLEX release so I can manually test it and confirm its working, but if anyone is interested in deploying it, here is what I did:
---Synology Console---
Install NANO via Package Center (I use SynoCommunity)
Add Plex Certificate to Synology Package Center (https://support.plex.tv/articles/205165858-how-to-add-plex-s-package-signing-public-key-to-synology-nas-package-center/)
Enable Notifications on Synology (Control Panel ... Notification)
Enable SSH (Control Panel ... Terminal & SNMP ... Enable SSH Service)
---SSH into Synology---
#Comment: Login with Administrator (or your Administrator account you created)
sudo -i
#Comment: Enter root password (usually Administrator password)
cd /volume1
mkdir Scripts
cd Scripts
nano plexupdate.sh
#Comment: Paste text into nano screen, no changes should need to be made
#!/bin/bash
mkdir /volume1/plextemp/ > /dev/null 2>&1
token=$(cat /volume1/Plex/Library/Application\ Support/Plex\ Media\ Server/Preferences.xml | grep -oP 'PlexOnlineToken="\K[^"]+')
url=$(echo "https://plex.tv/api/downloads/5.json?channel=plexpass&X-Plex-Token=$token")
jq=$(curl -s ${url})
newversion=$(echo $jq | jq -r .nas.Synology.version)
echo New Ver: $newversion
curversion=$(synopkg version "Plex Media Server")
echo Cur Ver: $curversion
if [ "$newversion" != "$curversion" ]
then
echo New Vers Available
/usr/syno/bin/synonotify PKGHasUpgrade '{"[%HOSTNAME%]": $(hostname), "[%OSNAME%]": "Synology", "[%PKG_HAS_UPDATE%]": "Plex", "[%COMPANY_NAME%]": "Synology"}'
cpu=$(uname -m)
if [ "$cpu" = "x86_64" ]; then
url=$(echo $jq | jq -r ".nas.Synology.releases[1] | .url")
else
url=$(echo $jq | jq -r ".nas.Synology.releases[0] | .url")
fi
/bin/wget $url -P /volume1/tmp/plex/
/usr/syno/bin/synopkg install /volume1/tmp/plex/*.spk
sleep 30
/usr/syno/bin/synopkg start "Plex Media Server"
rm -rf /volume1/tmp/plex/*
else
echo No New Ver
fi
exit
#Comment: Save file, CTRL + O and ENTER
#Comment: Close file, CTRL + X
bash plexupdate.sh
#Comment: Should show No New Ver
---Setup Update Scheduler---
#Comment: Go back to Synology Console
Open Control Panel
Open Task Scheduler
Click Create ... Scheduled Task ... User-defined script
Enter Task as Update Plex
Click Schedule Tab
Change Schedule to fit needs
Click Task Settings Tab
Enter User-defined script as bash /volume1/Scripts/plexupdate.sh
Click OK
#Comment: I unchecked the new script UNTIL I verify it works (next Plex version release)
Thanks for doing this, I too have been wanting something like this for a long time.
But I too am getting the same [289] install error using the Task Scheduler and root permissions. Mine is currently outdated and gets the same error when trying to install the latest version.