TechieGuy12 / PlexServerAutoUpdater

Automatically update Plex when running the Plex service.
MIT License
118 stars 9 forks source link

0.1.8.4 -silent update not running #30

Closed Eds1989 closed 5 years ago

Eds1989 commented 5 years ago

After updating to 0.1.8.4 for the new JSON update URL, my existing task that runs the executable with the -silent switch, no longer seems to do anything.

Running via the GUI, I see a new version available. Do I now also need to append the -force switch for this to work as a scheduled command line run?

TechieGuy12 commented 5 years ago

For a silent you will need to specify the -force switch if there is a media file being played when attempting to perform an update. The log file (%temp%\plex-updater.txt) should have a message indicating a file is being played.

If a media file is not being played, and you still can't update using the -silent switch, then it is an issue that I can look into.

Eds1989 commented 5 years ago

During my testing, there is no media playing.

So when I run the scheduled task, I see the action start, and then complete with a return code of 0. The update log file however, does not show any new entries, and only shows entries from when I ran via the GUI.

If I open command prompt as me (not "Run as administrator"), and run the same command with -silent, the log file updates but says: "2019-02-26 16:30:11 Getting windows user. 2019-02-26 16:30:11 Checking if user is an administrator."

If I open command prompt as administrator, and run the same command, the log file does not update.

I could try using the -force parameter too if you'd like, but if it works, I won't then be in a position to help diagnose why it doesn't work with just -silent, at least until the next update.

TechieGuy12 commented 5 years ago

When you used the "Run as administrator" option, did you look in the temp folder of the administrator account for the log file? It would be a different temp folder than the user you are logged in as, unless you are logged in as an administrator.

Eds1989 commented 5 years ago

I'm logged in as "an" administrator, not "the" administrator. The account I am using is my domain admin account, but not the main domain administrator account.

I've had a look under users\administrator\appdata\local\temp and can't see a log file there at all.

Eds1989 commented 5 years ago

I have just logged in as me (DOMAIN\Eds), run command prompt as an admin as I did before, then run: C:\Scripts\Plex Updater.exe -silent

I have found it drops a log file under my account, in: C:\Users\Eds\AppData\Local\Temp

Here is the output of the log file: `2019-03-07 12:53:15 Getting windows user. 2019-03-07 12:53:15 Checking if user is an administrator. 2019-03-07 12:53:15 Initializing the silent update. 2019-03-07 12:53:15 Getting the service user. 2019-03-07 12:53:15 The Plex service is installed. Let's get the user associated with the service. 2019-03-07 12:53:15 The Plex service user: DOMAIN\eds. 2019-03-07 12:53:15 Get the local data folder for Plex. 2019-03-07 12:53:15 Plex local data folder: D:\ 2019-03-07 12:53:15 Verify the updates folder is specified. 2019-03-07 12:53:15 Getting ready to download the latest package. 2019-03-07 12:53:15 Checking for the latest version from Plex. 2019-03-07 12:53:15 The update channel is set for Plex Pass. 2019-03-07 12:53:15 Parsing the information from Plex. 2019-03-07 12:53:15 The file, D:\Plex Media Server\Updates\1.15.1.710-ece95b3a1\packages\PlexMediaServer-1.15.1.710-ece95b3a1-x86.exe, exists. Checking to see if the package is valid. 2019-03-07 12:53:16 Checking if the installation package is valid. 2019-03-07 12:53:16 The package is valid. The checksums match. 2019-03-07 12:53:16 Since the package is valid - not downloading again. 2019-03-07 12:53:16 Verify the updates folder, D:\Plex Media Server\Updates exists. 2019-03-07 12:53:16 Checking to see if updates folder exists. 2019-03-07 12:53:16 Getting the latest update folder. 2019-03-07 12:53:16 Checking for the latest Plex packages folder. 2019-03-07 12:53:16 Get the latest packages file. 2019-03-07 12:53:16 Latest packages file: D:\Plex Media Server\Updates\1.15.1.710-ece95b3a1\packages\PlexMediaServer-1.15.1.710-ece95b3a1-x86.exe 2019-03-07 12:53:17 Checking for server update. 2019-03-07 12:53:17 The server is not in use continuing to perform the update. 2019-03-07 12:53:17 Message: Object reference not set to an instance of an object.

Inner Exception:

Stack Trace: at TE.Plex.SilentUpdate.CheckIfCanUpdate() at TE.Plex.SilentUpdate.Run()`

Not sure why I didn't see this file before, but now seems to be producing some output that is of use. Do you want to try the same again, but append -force?

TechieGuy12 commented 5 years ago

Thanks for the info. I will take a look to see what is causing the issue. In the meantime, if you can't get 0.1.8.4 to work, you can use 0.1.7.2, which is similar, but doesn't have the check to see if Plex is playing any media.

TechieGuy12 commented 5 years ago

I found the issue. I don't instantiate an object for the update - whether you use the -force argument or not. This object was added in 0.1.8.4, so 0.1.7.2 will work. This object is only used during the silent update, The GUI uses the same type of object, but that is instantiated, so it shouldn't be a problem using the GUI.

Eds1989 commented 5 years ago

Ok great. For the time being then, I'll run this particular update via the GUI ;)

If you want any help testing new builds running as a task with the silent parameter, let me know. Otherwise, I will await the next build :)

TechieGuy12 commented 5 years ago

I have made the change. On the next Plex update, try the latest release.

Eds1989 commented 5 years ago

Legend! Will do.

Eds1989 commented 5 years ago

Seemed to work as a task this time, however Plex didn't seem to restart correctly afterwards. Have attached the update log, that ends with stopping processes plex-updater.txt

Also, have the latest PMS log after a server restart a little while ago. pms-log.txt

Because of the repeated PMS log entries whereby Tautulli is starting and stopping, I'm not sure if this is likely to be a PMS issue, an updater issue, or a Tautulli issue?

TechieGuy12 commented 5 years ago

That's interesting. The update log looks fine. The processes are stopped at the end of the update so the Plex Service can run and then start up Plex, which will then restart all its processes.

I am not sure why Tautulli couldn't be started later in the day. It is hard to say, but perhaps Plex went down at that time? It appears to eventually have started, but it appears the Plex service started at the end of the log. Was the Plex service running after the update but before the Tautulli issue?

Eds1989 commented 5 years ago

So after the updater ran at 4am this morning, it seemed to complete the update. I only checked Plex remotely later in the day, and found it inaccessible remotely.

Logged onto my server, and the Plex service tray app couldn't connect to the service. Usually, when this happens, I have to reboot the server to get it all back up and running again (most times I think it occurs after an update but not 100% sure).

I rebooted the server sometime around 13:30, which is why you see the Plex services start in the log, but I think the log is truncated, and will probably have been trying to start Tautulli since 4am this morning when the update ran.

There looks to be another update available today, so I'll see what happens tomorrow. I suspect this is a PMS issue as much as anything though, so hopefully we can close this issue ;)

Eds1989 commented 5 years ago

Next update seemed to run absolutely fine.