Script to Auto Update Plex Media Server on Raspbian

Hi,
i modified a script by Martino to auto update my Plex Media Server with the latest PMS Beta.
Thanks to Martino for the initial script

Here is the script published on github:

and here the code:

installdir=/tmp
token=$(cat /var/lib/plexmediaserver/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 .computer.Linux.version)
#echo New Ver: $newversion
curversion=$(dpkg -s plexmediaserver | grep -i version)
curversion=${curversion/"Version: "/""}


if [ "$newversion" != "$curversion" ];then
echo "New Plex Media Server Version Available"

cpu=$(uname -m)
#echo $cpu

echo
if [ "$cpu" = "armv7l" ]; then
url=$(echo $jq | jq -r ".computer.Linux.releases[3] | .url")

mkdir -p $installdir/tmp/

rm $installdir/tmp/*
echo "Downloading new Version ($newversion) ..."
wget $url -P $installdir/tmp/
dpkg -i $installdir/tmp/*armhf.deb
mv $installdir/tmp/*.dpkg $installdir/
echo "New Plex Media Server Installed (Old Version: $curversion, New Version: $newversion)"
#sleep 30

else
echo "No New Version"
fi

else
echo "No New Version for Plex Media Server (Ver. $curversion)"

fi

exit

here the link to the original thread by martino:

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.