If you wanted to be a BA, you could even cronjob that thing to update itself every night at 3am. :p
Couldn't help myself
# PlexUpdate.sh
will download the latest public release to
/usr/pbi/plexmediaserver-amd64/sharePlexMediaServer-[version]-freebsd-amd64.tar.bz2
if there is no file there by that name
# PlexUpdate.sh download PlexPassUsername PlexPassPassword
will download the latest plexpass release to
/usr/pbi/plexmediaserver-amd64/sharePlexMediaServer-[version]-freebsd-amd64.tar.bz2
if there is no file there by that name
# PlexUpdate.sh AUTOUPDATE
Will download latest public release and update to it
# PlexUpdate.sh AUTOUPDATE PlexPassUsername PlexPassPassword
Will download latest plexpass release and update to it
DISCLAIMER I've tested it some, but I'm sure there are still many ways it can fail.
It will probably set fire to your server and curse your family for generations.
And auto updating probably not so much a good idea, but like I said, couldn't help myself.
PlexUpdate.sh
Code:
#!/bin/sh
USERNAME=$2
PASSWORD=$3
URL="https://plex.tv/downloads?channel=plexpass"
PMSPARENTPATH="/usr/pbi/plexmediaserver-amd64/share"
PMSLIVEFOLDER="plexmediaserver"
PMSBAKFOLDER="plexmediaserver.bak"
DOWNLOADPAGE=`curl -m 5 -silent -u $USERNAME:$PASSWORD $URL`
if [ $? -ne 0 ]; then
echo Error downloading $URL
else
DOWNLOADURL=`echo $DOWNLOADPAGE | grep -o 'http[[:print:]]*-freebsd-amd64.tar.bz2'`
if [ "x$DOWNLOADURL" = "x" ]; then
echo Could not find a PlexMediaServer-[version]-freebsd-amd64.tar.bz2 download link on page $URL
else
DOWNLOADFILE=`basename $DOWNLOADURL`
if [ ! -e $PMSPARENTPATH/$DOWNLOADFILE ]; then
wget -qP $PMSPARENTPATH $DOWNLOADURL
if [ $? -ne 0 ]; then
echo Error downloading $DOWNLOADURL
elif [ "$1" = "AUTOUPDATE" ]; then
if [ ! -s $PMSPARENTPATH/$DOWNLOADFILE ]; then
echo $DOWNLOADFILE is zero bytes, cannot update with this file.
else
rm -rf $PMSPARENTPATH/$PMSBAKFOLDER
service plexmediaserver stop
mv $PMSPARENTPATH/$PMSLIVEFOLDER/ $PMSPARENTPATH/$PMSBAKFOLDER/
mkdir $PMSPARENTPATH/$PMSLIVEFOLDER/
tar -xj --strip-components 1 --file $DOWNLOADFILE --directory $PMSPARENTPATH/$PMSLIVEFOLDER/
if [ $? -ne 0 ]; then
rm -rf $PMSPARENTPATH/$PMSLIVEFOLDER/
mv $PMSPARENTPATH/$PMSBAKFOLDER/ $PMSPARENTPATH/$PMSLIVEFOLDER/
echo Error exctracting $DOWNLOADFILE
fi
service plexmediaserver start
fi
fi
fi
fi
fi