michealespinola / syno.plexupdate

A script to automagically update Plex Media Server on Synology NAS
GNU General Public License v3.0
273 stars 23 forks source link

selfupdate issue - maybe timezone related? #33

Closed theUtmostgit closed 1 year ago

theUtmostgit commented 1 year ago

Firstly - wanted to say how much I really appreciate this script! It's still working in terms of updating PMS, but, doesn't seem to be able to update itself past script v4.0.0. Synology NAS: DS916+ DSM is DSM 7.1.1-42962 Update 1. PMS updated to latest version just last night at script run.

I've been using this script for a while now (started with it on DSM6.2 ish) and aside from manual intervention at DMS > v7 update it still works for updating PMS. It LOOKS like it could be date format misinterpretation. For ref I am in New Zealand, right now we are in Daylight Time, which is UTC+13, whereas for the other half of the year we are UTC+12: https://www.timeanddate.com/time/zone/new-zealand

Here is some script output showing different date format which I think means it's failing to recognise the script SHOULD self update ?


Task: Syno.Plex update 
Start time: Wed, 09 Nov 2022 04:45:01 GMT 
Stop time: Wed, 09 Nov 2022 04:45:43 GMT 
Current status: 1 (Interrupted) 
Standard output/error: 

SYNO.PLEX UPDATE SCRIPT v4.0.0 

     Script: [syno.plexupdate.sh](http://syno.plexupdate.sh/) v4.0.0 
 Script Dir: /volumex/redacted/Path/to/syno.plexupdate 
Running Ver: 4.0.0
 Online Ver: 4.1.0 
   Released: 2022-11-09 00:00:00+13:00 (0+ days old) 
             * Newer version found! Update newer than 7 days - skipping...

See the "released" date for the script is not actually true, I think that script v4.1.0 has been out a while now? It seems to be hungup on my local time, and format YYYY-MM-DD 24h time notation. I'll just manually replace the .sh script with latest version myself to fix it but if I have this issue, chances are someone else out there may also? Cheers!

michealespinola commented 1 year ago

See the "released" date for the script is not actually true, I think that script v4.1.0 has been out a while now?

Yep, it's been out for 113+ days. I was on the verge of releasing the next update (4.1.1) with minor code tweaks, but I'm going to put that on hold for a bit while I look into this.

The script on your system is definitely showing the wrong date for the "Online" version. The current online release version (4.1.0) should be showing this line:


   Released: 2022-07-18 10:34:39-07:00 (113+ days old)

It should be pulling that released date directly from GitHub, so seeing today's date with the time being zeroed is highly unlikely to ever be accurate. I would try manually updating to the latest version and see if that date bug followed it. I am constantly testing versions of the code on myself, and I can say that I have never seen it do that.

theUtmostgit commented 1 year ago

Thanks heaps for looking into this, and yeah it does all seem weird. Everything including the NAS on this network seems to get the right time via NTP from the router. yep, I will manually replace that script with v 4.1.0, try to do that tonight and let you know the outcome! Cheers!

theUtmostgit commented 1 year ago

Well that's odd. Put newer script in. Kicked off from task scheduler, and in the output log file are only two lines:

line 8: syntax error near unexpected token newline' line 8:<!DOCTYPE html>'

This might be my fault for failing to save the .sh file correctly, if so I apologise, I'll have another go tonight when I have more time, cheers

theUtmostgit commented 1 year ago

It was indeed my own error... I foolishly right-clicked on the .sh script and being in a rush didn't notice that the option wasn't save file as, but rather save link as... Anyway, after replacing the largish piece of HTML code snippet with your actual script, v4.1.0 seems to be running fine!

Pretty sure you can close this one as while the self-update didn't work, a manual replace seems to have made the self update check now detect correct versions:

SYNO.PLEX UPDATE SCRIPT v4.1.0 for DSM 7

   Script: syno.plexupdate.sh

Script Dir: /volumex/Redacted/path/to/syno.plexupdate Running Ver: 4.1.0 Online Ver: 4.1.0 Released: 2022-07-19 05:34:39+12:00 (113+ days old)

Cheers and thanks again!

michealespinola commented 1 year ago

Awesome possum, I'm glad it all that sorted itself relatively painlessly. It would have been nice to know what was going on in the first place, but I think it was likely a glitch than a bug in the script because the date processing bits are pretty standard.

Thanks for closing it out.