Giter Club home page Giter Club logo

plexupdate's Introduction

plexupdate.sh

plexupdate

Plex Update is a bash script which helps you keep Plex Media Server up to date on Linux.

You can schedule updates to run daily and install Plex Pass beta releases if you have a Plex Pass membership.

Installation

In the old days, this used to be a bit of a chore. But no more!

bash -c "$(wget -qO - https://raw.githubusercontent.com/mrworf/plexupdate/master/extras/installer.sh)"

will automatically install the tool as well as any dependencies. This has been tested on Ubuntu, Fedora and CentOS but should, for the most part, work on any modern Linux distribution.

If you'd ever like to change your configuration, just re-run the installer from the extras folder inside your plexupdate directory. (/opt/plexupdate/extras/installer.sh by default)

If you have any trouble with the installer, or would just prefer to set plexupdate up manually, read the guide.

Advanced options

There are a few additional options for the more enterprising user. Setting any of these to yes will enable the function.

  • CHECKUPDATE If you didn't install using git clone or by running the installer, you can use this option to notify you when there are updates to plexupdate. If you used git or the installer, see AUTOUPDATE instead.
  • PLEXSERVER If set, and combined with AUTOINSTALL, the script will automatically check if the server is in use and defer the update. Great for crontab users. PLEXSERVER should be set to the IP/DNS of your Plex Media Server, which typically is 127.0.0.1
  • PLEXPORT Sets the port to use along with PLEXSERVER
  • AUTOUPDATE Makes plexupdate.sh automatically update itself using git. This only works if you installed using git clone or by using the installer.
  • AUTOINSTALL Automatically installs the newly downloaded version. Currently works for Debian based systems as well as rpm based distros. Requires root permissions.
  • AUTODELETE Delete the downloaded package after installation is complete to conserve disk space.
  • PUBLIC The default behavior of plexupdate.sh is to download the PlexPass edition of Plex Media Server. Setting this option to yes will make it download the public version instead.
  • FORCE Normally plexupdate.sh will avoid downloading a file it already has or if it's the same as the installed version. Using this option will force it to download again UNLESS the file already downloaded has the correct checksum. If you have AUTOINSTALL set, plexupdate.sh will then reinstall it.
  • PRINT_URL Authenticate, fetch the download URL, print it, and then exit.
  • DISTRO_INSTALL The command used to install packages, only change if you need special options. Natively supports Debian and Redhat, so you don't need to set this for these systems. NOTE! If you define this, you MUST define DISTRO and BUILD
  • DISTRO and BUILD Override which version to download, use -l option to see what you can select.
  • TOKEN If you want to install Plex Pass releases, plexupdate will try to get your account token directly from your Plex Media Server. If you want to use a different token to authenticate, you can enter it here instead. Please read Authenticating with Plex Pass on the wiki for more details.
  • SYSTEMDUNIT If set, plexupdate.sh will use a custom systemd unit during AUTOSTART, which may be necessary when you are using a custom NAS package. The default is plexmediaserver.service.

Most of these options can be specified on the command-line as well, this is just a more convenient way of doing it if you're scripting it. Which brings us to...

Command Line Options

Plexupdate comes with many command line options. For the most up-to-date list, run plexupdate.sh with -h

Here are some of the more useful ones:

  • --config <path/to/config/file> Defines the location the script should look for the config file.
  • --dldir <path/to/where/you/want/files/downloaded/to> This is the folder that the files will be downloaded to.
  • --server <Plex server address> This is the address that Plex Media Server is on. Setting this will enable a check to see if users are on the server prior to the software being updated.
  • --port <Plex server port> This is the port that Plex Media Server uses.

FAQ

Do I have to use the extras/installer.sh?

Of course not, anything you find under extras/ is optional and only provided as an easier way to get plexupdate.sh up and running quickly. Read the guide for installing plexupdate manually.

Why am I getting a warning about email and password being deprecated?

Since just storing your password in plexupdate.conf isn't secure, plexupdate will now use a "token" instead. To make this warning go away just re-run the installer (extras/installer.sh) or manually remove EMAIL and PASS from your plexupdate.conf. For more details, see this wiki article.

Need more information?

See https://github.com/mrworf/plexupdate/wiki for more information

plexupdate's People

Contributors

abealsaleh avatar ajmiller82 avatar altonv avatar apocrathia avatar benhaines avatar darrin0101 avatar demonbane avatar didyouexpectthat avatar diedthreetimes avatar exetico avatar gboudreau avatar hakong avatar joemiller avatar kezxo avatar lisanet avatar markglenn avatar martijndierckx avatar mpwdawson avatar mrtumnus avatar mrworf avatar mscreations avatar pumbaasdad avatar tommatheussen avatar vidschofelix avatar xombiemp avatar xorpaul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plexupdate's Issues

Error when running script

I am on Ubuntu 14.04.2 when running the script with sudo sh plexupdate.sh i get:

plexupdate.sh: 92: [: no: unexpected operator
plexupdate.sh: 121: [: unexpected operator
plexupdate.sh: 126: [: no: unexpected operator
plexupdate.sh: 149: plexupdate.sh: Syntax error: Bad for loop variable

I've added the .plexupdate file under my home dir with my login details

Is there anything i can do?

Thanks

KEEP doesn't do anything

It looks like KEEP has been rendered useless since 170db36. Since /tmp/kaka is deleted on exit, there's really no option to keep your session anymore. I personally don't care all that much, so just removing it altogether would work. If you want to have it work I'm happy to send in a PR since I've already dug into the code to see why it's not working in the first place.

Plex Pass authentication failing

Something is wrong with the plexpass authentication. Posts at the end of this thread explain that the new website has changed something and with the current script setup the failed authentication just returns the non plex pass version.

./plexupdate.sh -p -C produces non-actionable output

first run:
./plexupdate.sh -p -C
Your distribution may require the use of the AUTOSTART [-s] option for the service to start after the upgrade completes.
Downloading release "plexmediaserver-1.0.0.2261-a17e99e.i386.rpm"...OK

second run:.
/plexupdate.sh -p -C
Your distribution may require the use of the AUTOSTART [-s] option for the service to start after the upgrade completes.

There is also a exit 2 as the return status.
Expected output should be nothing and return code of 0.
The AUTOSTART exit 2 should likely be a function of either AUTOINSTALL or AUTOUPDATE set to "yes" instead.
Basically creates the option for using this script as a cron checker for updates that only notifies when there is an update.

Thanks
PJ

Get rid of -S

Just opening this as an issue before sending in a PR to see if there are any objections. -S seems completely unnecessary for experienced users, and dangerous for inexperienced ones. If you know what you're doing, ./plexupdate.sh -q 2>/dev/null does exactly the same thing. If you don't know what you're doing, -S only serves to hide all possible output from you which seems like a terrible idea.

It looks like it was added in #53 with the comment "Added a silent mode argument (because why not?)", which just seems like the worst possible reason to ever add anything to a piece of software.

Looks for configuration in wrong directory

Running as superuser is required to actually install updates in CentOS, but when this is done the script looks in the home directory of root rather than of the current user.

Error Installing 64-bit on ARM

The package (64-bit) downloaded fine, but returned "ERROR: dpkg: error processing /root/plexmediaserver_0.9.16.4.1911-ee6e505_amd64.deb"

Apparently, my server has an ARM processor and the dpkg didn't like it.

See here --> [img]http://i.imgur.com/S4PMZbV.png[/img]

Error Since Latest Plex Version

root@cinaplex:# /root/plexupdate.sh
Authenticating...OK
Finding download URL for 64-bit...OK
Sorry, page layout must have changed, I'm unable to retrieve the URL needed for download
root@cinaplex:
#

Can't upgrade, plexupdate thinks someone is using the server

Debian 8
plexupdate says my server is in use so it can't bother to AUTOINSTALL.

root@plex-cinema:/opt/plexupdate# ./plexupdate.sh
Authenticating...OK
Finding download URL to download...OK
File already exists (plexmediaserver_1.0.3.2461-35f0caa_amd64.deb), won't download.
Server 127.0.0.1 is currently being used by one or more users, skipping installation. Please run again later

I confirm it is not in use.
plexupdate runs a wget to my PLEXSERVER, but the server is rejecting the request due to invalid credentials.

root@plex-cinema:/opt/plexupdate# ./plexupdate.sh
Authenticating...OK
Finding download URL to download...OK
File already exists (plexmediaserver_1.0.3.2461-35f0caa_amd64.deb), won't download.
--2016-07-29 21:31:06--  https://127.0.0.1:32400/status/sessions
Connecting to 127.0.0.1:32400... connected.
The certificate's owner does not match hostname ‘127.0.0.1’
HTTP request sent, awaiting response... 401 Unauthorized

Username/Password Authentication Failed.
Server 127.0.0.1 is currently being used by one or more users, skipping installation. Please run again later

From Plex

Jul 29, 2016 21:38:05.927 [0x7fc1167ff700] DEBUG - Request: [::ffff:127.0.0.1:50380] GET /status/sessions (12 live) TLS
Jul 29, 2016 21:38:05.930 [0x7fc1237ff700] DEBUG - Completed: [::ffff:127.0.0.1:50380] 401 GET /status/sessions (12 live) TLS 2ms 260 bytes

I have: PlexPass, 127.0.0.1 and LAN subnet entered in "List of networks that are allowed without auth", I have Home setup.
It could very well be because Home is setup; and if that's the case, maybe do a RESULTCODE for 401 and warn about Home; if it is Home, then I will just disable the check and do it live 👍 I'm unwilling to disable Home right now to confirm though.

I also found these when I was making the output more verbose, but probably resulted from making some commands more verbose.

./plexupdate.sh: line 373: [: -eq: unary operator expected
./plexupdate.sh: line 376: [: -ne: unary operator expected

Readme issues

I tried following the guide and found a few issues. Everything is working now but it may help for those in the future who try installing it.

In 2. setting it up you have it set to email and pass, but in TL;DR, you have user and pass. User and pass wont work if the user has the only accept email option enabled.

Second thing, wget https://github.com/mrworf/plexupdate/blob/master/plexupdate.sh downloads the html page, not the actual code.

https://raw.githubusercontent.com/mrworf/plexupdate/master/plexupdate.sh would be the right link instead.

Folder not empty error

When running the update, I would get cannot delete directory; not empty, when it tries to presumably replace the bundles with updated info. Is this normal?

Script stuck on Auto updating

It seems the script is stuck at auto updating, I always get "Auto updating...OK" out from the script, multiple times after each other (seems like it never moves on to the next phase).

Playing around with some stuff I first thought it was because I had my config and log file moved into the same folder, but when I remove the location of my .plexupdate file from the command, it seems to be working just fine again.

Also disabling Auto update in the config file, and specifying the config's location does work.

EDIT: After some more investigating, it seems that the problem originates from here: https://github.com/mrworf/plexupdate/blob/master/plexupdate.sh#L233

this is the log I get when I print out the ALLARGS variable:

Auto updating...OK
../.plexupdate
Auto updating...OK
../.plexupdate -U
Auto updating...OK
../.plexupdate -U -U
Auto updating...OK
../.plexupdate -U -U -U
Auto updating...OK
../.plexupdate -U -U -U -U
Auto updating...OK
../.plexupdate -U -U -U -U -U

Username and password verification not working

When grepping the raw data for 'Sign In</title' this will always not find it since that text string doesn't exist on the new website.

Better to search for 'Logout' to verify login success.

Script cannot run - /bin/bash^M: bad interpreter

When running the script, I get:
bash: ./plexupdate.sh: /bin/bash^M: bad interpreter: No such file or directory

I had to install package tofrodos and run the fromdos utility.
TIP: Don't write linux scripts on windows? :)

force flag doesn't work with config file

sudo ./plexupdate.sh .plexupdate -f
Authenticating...OK
Finding download URL to download...OK
Your OS reports the latest version of Plex (1.0.1.2396-c094d0d) is already installed. Use -f to force download.

Problem with Download directory

My .plexupdate file contains:
DOWNLOADDIR="/data/plexmediaserver/Library/Application Support/Plex Media Server"

When I try to run plexupdate I'm getting:
Error: Download directory does not exist or is not a directory

I noticed you committed a change recently for checking the download directory. On line 136 you are doing eval pushd. I tried this command by itself in the bash prompt with my directory and got this:
bash> eval pushd "/data/plexmediaserver/Library/Application Support/Plex Media Server"
-bash: pushd: /data/plexmediaserver/Library/Application: No such file or directory

I then tried the same command but without the eval part and it worked fine. So I tried removing the eval command on line 136 so it just says pushd and the script ran fine for me. Not sure exactly what is happening, but I think it has to do with spaces being in my path. Why is the eval there and is it necessary? The script only runs for me if it's not there.

Cron mode doesn't really make sense

I'm struggling to understand what scenario -c is actually meant for.

Every cron implementation I've used just ignores exit codes completely, so -c would seem to have nothing at all to do with "cron". It looks like it was mostly meant to reconcile what @hakong wanted in #62 (which doesn't seem directly cron related to me) vs #73.

What I'm wanting to accomplish (without adding yet another command line option) is just a cron mode that only produces output when something has changed. If you have the latest version, no output. If you don't have the latest version, produce output on STDOUT. If there's an error (regardless of if there's a new version or not) produce output on STDERR.

This way, -q and -S actually become useful modifiers to -c, whereas they currently largely replace it. (running with -cq is functionally identical to running with -q inside cron).

I'm happy to send in a PR for this functionality, I just wanted to bring this up ahead of time to make sure that I'm not stepping on any toes by doing so (or missing something obvious).

Error since upgrading Ubuntu 15.04 (support for Ubuntu 15.04)

First to say, that this script is awesome and it makes plex on linux so much easier, thanks

I have updated my Linux server updated to Ubuntu 15.04.
I understand that Canonical changed the boot and service management.
And when running the script, im getting errors

stop: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused

Installing new version of config file /etc/default/plexmediaserver ...
Failed to execute operation: File exists

dpkg: error processing package plexmediaserver (--install):
subprocess installed post-installation script returned error exit status 1

Errors were encountered while processing:
plexmediaserver

Server reported as in use while the servce is stopped.

Hello,

I'm using commit # 482f1d2.
When my PMS server is stopped, I still get the following error. Any ideas?

My service
root@plex:~/plexupdate# bash plexupdate.sh
Auto updating...OK
Authenticating...OK
Finding download URL to download...OK
File already exists (plexmediaserver_1.1.1.2675-d00866c_amd64.deb), won't download.
Server 127.0.0.1 is currently being used by one or more users, skipping installation. Please run again later

New checksum check feature broken

root@plex-tv:/opt/plexupdate# ./plexupdate.sh -f
Auto updating...OK
Authenticating...OK
Finding download URL to download...OK
sha1sum: plexmediaserver_1.1.2.2680-09e98fb_amd64.deb: No such file or directory
Note! File exists but fails checksum. Redownloading.
Downloading release "plexmediaserver_1.1.2.2680-09e98fb_amd64.deb"...OK
sha1sum: plexmediaserver_1.1.2.2680-09e98fb_amd64.deb: No such file or directory
Downloaded file corrupt. Try again.
root@plex-tv:~/plex_files# sha1sum plexmediaserver_1.1.2.2680-09e98fb_amd64.deb; cat plexmediaserver_1.1.2.2680-09e98fb_amd64.deb.sha
f255a394d5df653bb555a79285cfda66feb7025c  plexmediaserver_1.1.2.2680-09e98fb_amd64.deb
f255a394d5df653bb555a79285cfda66feb7025c  plexmediaserver_1.1.2.2680-09e98fb_amd64.deb
root@plex-tv:~/plex_files# sha1sum --status -c /root/plex_files/plexmediaserver_1.1.2.2680-09e98fb_amd64.deb.sha
root@plex-tv:~/plex_files# echo $?
0

Seems that the new checksum addition doesn't work right.
It downloads the correct checksum file but fails to find the correct file.

echo "${CHECKSUM}  ${FILENAME}" >${DOWNLOADDIR}/${FILENAME}.sha

I think this is because ${DOWNLOADDIR}/${FILENAME} is necessary.

echo "${CHECKSUM}  ${DOWNLOADDIR}/${FILENAME}" >${DOWNLOADDIR}/${FILENAME}.sha
root@plex-tv:/opt/plexupdate# /opt/plexupdate/plexupdate.sh
Authenticating...OK
Finding download URL to download...OK
Your OS reports the latest version of Plex (1.1.2.2680-09e98fb) is already installed. Use -f to force download.
root@plex-tv:/opt/plexupdate# /opt/plexupdate/plexupdate.sh -f
Authenticating...OK
Finding download URL to download...OK
File exists and checksum passes, won't redownload.
DATA: '<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="0">
</MediaContainer>'
(Reading database ... 36667 files and directories currently installed.)
Preparing to unpack .../plexmediaserver_1.1.2.2680-09e98fb_amd64.deb ...
Removed symlink /etc/systemd/system/multi-user.target.wants/plexmediaserver.service.
Unpacking plexmediaserver (1.1.2.2680-09e98fb) over (1.1.2.2680-09e98fb) ...
Setting up plexmediaserver (1.1.2.2680-09e98fb) ...
Processing triggers for mime-support (3.58) ...
Processing triggers for systemd (215-17+deb8u4) ...

Autoupdate recieves an error

When using the AUTOUPDATE functionality, setting AUTOUPDATE=yes I recieve the following error:

Auto updating...OK
plexupdate.sh: line 124: plexupdate.sh: command not found

I'm using Ubuntu 14.04 64bit.

ERROR: Unable to retrieve the URL needed for download (Query DISTRO: ubuntu, BUILD: 64)

It looks like the download page for Plex has changed.
I used -x in the bash script to see the whole thing. I'm pasting it below.

+ echo -n 'Finding download URL to download...'
Finding download URL to download...++ grep -m1 -ioe 'https://[^\"]*'
++ grep -i '"build":"64"'
++ grep -i '"distro":"ubuntu"'
++ grep -ioe '"label"[^}]*'
++ wget --load-cookies /tmp/kaka --save-cookies /tmp/kaka --keep-session-cookies 'https://plex.tv/api/downloads/1.json?channel=plexpass' -O -
+ DOWNLOAD=
+ '[' no = no ']'
+ echo -e OK
OK
+ '[' '' == '' ']'
+ echo 'ERROR: Unable to retrieve the URL needed for download (Query DISTRO: ubuntu, BUILD: 64)'
ERROR: Unable to retrieve the URL needed for download (Query DISTRO: ubuntu, BUILD: 64)
+ exit 3
+ cleanup
+ rm /tmp/postdata
+ rm /tmp/raw
+ rm /tmp/failcause
+ '[' no '!=' yes ']'
+ rm /tmp/kaka



Automatic script update

Is there a possibility to make this script auto updating, for example every time the user runs the script it will download a new version if available. Could be directly from github.

I'm not into bash script or Linux programming, but I can take a look if I can make a start.

Doesn't produce expected result on CentOS

Thanks for a great script, however there are other distributions besides Ubuntu, yet it still downloads the deb-file when ran on CentOS.

Unfortunately just replacing .deb with .rpm didn't work as the naming convention is slightly different for CentOS/RHEL and my sed-mojo is not strong enough to overcome the problem.

Here's what I get when replacing .deb with .rpm:

Authenticating...OK
Finding download URL for 64-bit...OK
Downloading release "plexmediaserver-0.9.9.10.458-008ea34.x86_64.rpm"...
!! Download failed with code 8, "--2014-05-20 14:14:36-- http://downloads.plexapp.com/plex-media-server/0.9.9.10.458-008ea34/plexmediaserver-0.9.9.10.458-008ea34.x86_64.rpm%0Ahttp://downloads.plexapp.com/plex-media-server/0.9.9.10.458-008ea34/plexmediaserver-0.9.9.10.458-008ea34.x86_64.rpm
Resolving downloads.plexapp.com... 64.71.188.199
Connecting to downloads.plexapp.com|64.71.188.199|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2014-05-20 14:14:36 ERROR 404: Not Found."

PS. I think you can check wherever the script is running on CentOS/RHEL/OUL by checking if the file /etc/redhat-release exists.

Script doesn't work with PlexPass

Thanks for your script, very useful !

Trying to update with my login/pwd in script just downloads plexmediaserver_0.9.12.4.1192-9a47d21_amd64.deb while plexmediaserver_0.9.12.7 is available for plexpass users.

Using ~ in quoted DOWNLOADDIR causes download to fail

This is an error not caused by the script itself, but by how wget and/or the shell treats this value.

The typical error an end-user sees is this:

$ ./plexupdate.sh   
Authenticating...OK
Finding download URL for 64-bit...OK
 !! Download failed with code 1, "~/.plexupdates/plexmediaserver_0.9.12.12.1459-49fe448_amd64.deb: No such file or directory"

This can be reproduced independently from the script itself:

# quoted with ~, fails
$ wget -O "~/.plexdownloads/test1.deb" 
https://downloads.plex.tv/plex-media-server/0.9.12.11.1406-8403350/plexmediaserver_0.9.12.11.1406-8403350_amd64.deb

# unquoted with ~, succeeds
$ wget -O ~/.plexdownloads/test2.deb 
https://downloads.plex.tv/plex-media-server/0.9.12.11.1406-8403350/plexmediaserver_0.9.12.11.1406-8403350_amd64.deb

# expanded ~ with quotes, succeeds
$ wget -O "/home/user/.plexdownloads/test3.deb" 
https://downloads.plex.tv/plex-media-server/0.9.12.11.1406-8403350/plexmediaserver_0.9.12.11.1406-8403350_amd64.deb

Since we really want to be quoting our strings, the remaining option is to expand the DOWNLOADDIR-variable ourselves, and for now that is also a reasonable manual workaround, but it should be documented.

For the future, the script should be able to apply this workaround itself.

download doesn't work

I think plex team had made some modification on the plex pass web site:
now the release value must be set to RELEASE="64 bit" instead of 64-bit

regards

Error when having $ (dollar sign) in password

Hello!

I am getting Error: Username and/or password incorrect when using your script.
My password has all the crazy characters in it ($, @, &, !, %), so I did some testing and it seems like the URL encode (?) can't handle $ (dollar signs), because when I remove that it works perfectly.

A quick fix for me would be to remove the dollar signs from my password, but I am wondering if there is any other way to do it

Ubuntu 14.10 (Linux server 3.16.0-43-generic)

./plexupdate.sh: line 505: sudo: command not found

While running the script as root on debian the following issue comes up:

./plexupdate.sh: line 505: sudo: command not found

If I go into line 505 and remove the sudo the download works...

Debian GNU/Linux 8

Update failed with latest update (0.9.2.11.1406-8403350)

I tried the script on both of my Ubuntu boxes this evening. Note: Script worked fine last upgrade.

I checked GIT for an update, then ran the script this evening. (although in briefly looking at the code, it's got an auto-updater now?)

All it seemed to do is download the upgrade file, but didn't go any further. No error message, until I thought I'd made a mistake and tried it again. Then it was kind of upset that the file to download was already there. :)

dpkg: warning: unable to delete old directory '/usr/lib/plexmediaserver/Resources/Plug-ins-a17e99e': Directory not empty

I get this error whenever I update using plexupdate.sh (obviously the hex value in the Plug-ins-a17e99e changes with each version.) I have a YouTube plugin that for some reason never seems to be moved when I perform an update. This is an Ubuntu PMS install and the permissions seem to match all the other plugins folders and I'm using sudo when running it.

I can manually go in an do something like:

sudo mv /usr/lib/plexmediaserver/Resources/Plug-ins-a17e99e/* /usr/lib/plexmediaserver/Resources/Plug-ins-c093d0d/

and it moves fine, I can then safely delete /usr/lib/plexmediaserver/Resources/Plug-ins-a17e99e

Since the error appears to be from dpkg, I'm not sure why some plugins seem to be moved while this youtube one doesn't. Any ideas?

I should mention that PMS is successfully updated, but since that YouTube plugin isn't moved over, it stops showing up under Channels after I update PMS (until I manually move it.)

dpkg interrupts update installer if Plex config file is changed

I would like to update Plex automatically on my Ubuntu server 14.04 from cron so for that your script comes in perfectly.

However I edited Plex' config file (/etc/default/plexmediaserver) to run Plex as a different user and that results in dpkg interrupting the installation process.

I ran your script as:

$ sudo plexupdate.sh -a -d -p -u

And I get the following message from dpkg:

Configuration file '/etc/default/plexmediaserver'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** plexmediaserver (Y/I/N/O/D/Z) [default=N] ?

I looked through the dpkg command line options hoping I could add one on line 333 of your script as to automatically skip the manual confirmation but I didn't find anything useful.

Is it possible for you to update the script so fully unattended Plex updates are possible in my situation as well? Or can you give me recommendations for it?

Thanks!

systemd timer and service unit

Not an issue really, just thought i'd throw in a timer and service unit here. Do what you want with it. People also need to change the path and maybe user depending on how it's run.

/etc/systemd/system/plexupdate.service

[Unit]
Description=plexupdate
After=network.target

[Service]
ExecStart=/root/plexupdate/plexupdate.sh -a -c -d -p -s -u

/etc/systemd/system/plexupdate.timer

[Unit]
Description=Run the plex updater daily

[Timer]
OnCalendar=daily
Persistent=true     

[Install]
WantedBy=timers.target
systemctl daemon-reload
systemctl enable plexupdate.timer

Now bring the systemd hate and tell me it's simpler in cron! 😆 ng:

Check plex current usage before updating

I'm currently using a wrapper script to validate that Plex is not in use before running this script. I utilize the plexwatch tool, but it would be cool if this had something built in. I may have modified your original script as well, to make it work smoother with the wrapper. Will check if you're interested

Detect current version to see if it needs an update

I'd love to see a basic function in the beginning that would check the web version against the current version to see if an update is needed.

CURRENTVER=export LD_LIBRARY_PATH=/usr/lib/plexmediaserver; /usr/lib/plexmediaserver/Plex\ Media\ Server --version | awk -F[v-] '{print($2)}' would give the numeric string of the version.

Keep getting errors trying to run the script

I made a .plexupdate file with my info in it but i keep getting this:
plexupdate.sh: 92: [: no: unexpected operator
plexupdate.sh: 121: [: [email protected]: unexpected operator
plexupdate.sh: 126: [: no: unexpected operator
plexupdate.sh: 149: plexupdate.sh: Syntax error: Bad for loop variable

Any ideas?

yum waits for confirmation before update on CentOS

Great work on the script, just fantastic! I may be running this wrong but yum waits for you to accept the install before it will update the RPM package.

OS: CentOS 6.6

Scenario: Run .sh script with -a option

Issue: Script will download and hang on yum install screen. Waiting for you press "y/n" to accept the new RPM install.

Workaround: Modify line #285
From: sudo yum localinstall "${DOWNLOADDIR}/${FILENAME}"
To: sudo yum -y localinstall "${DOWNLOADDIR}/${FILENAME}"

The -y option auto accepts yum messages.

If you use .plexupdate config file and have problems updating plex...

If you're using a .plexupdate configuration file in your home directory and that file specifies the release with RELEASE=, then be sure to change it from RELEASE=64-bit to RELEASE=64. Otherwise you'll get the error Sorry, page layout must have changed, I'm unable to retrieve the URL needed for download.

User Credentials

Is the username and password for the server that pms is being installed on?

Autoinstall command for RPM-based distros

First, great script. :) Just a note that "rpm -i" should be "rpm -u" (to upgrade the RPM) for an auto-upgrade. Though, it's probably best to use "yum localinstall $RPM" instead so that it can decide the correct action and pull any dependencies too.

Progress Bar While Downloading

First of all I want to say I absolutely love you script. It has made updating Plex on my server a breeze.

I am wondering if it would be possible to add a progress bar when the PMS file is downloading?

Eternal AutoUpdate

When the autoupdate option (-u) is used the script keeps looking for updates in loop forever.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.