Next month: January 2017
The second problem was that the separate script to grab UK multi-raffle winning numbers was looking at the previous draw's info until all the rest of the latest draw's info was in place, at which point it would then switch to the latest draw's raffle winners. Luckily, this would only mean a 2 minute delay, but I now pass the latest draw number to the separate script and it now uses that as the draw number, even if the main data file doesn't have that draw number info in it yet. Makes the raffle numbers appear 2 minutes more quickly now...whoo!
As a precaution, I now back up the three lottery data files before I start any auto-scraping in case it goes berserk again. I think I've tracked down the issue to the lack of "--date=yesterday" in HP-UX's date command (it's in the Linux/coreutils version). Luckily, I have access to a coreutils version of date on HP-UX which does support that option, so I'm pointing to that now. I also will no longer update a data file if the new version is zero length (yes, an obvious check, but I hadn't put that in until now...duh).
I've put the fixed code through some dummy runs (which I really should have done when the code was finished!) simulating being run after midnight without the latest draw results and everything seems fine now for Euro Millions post-midnight processing. I've disabled the post-midnight processing for the main Lotto and Thunderball for the moment, but will do dummy runs early on Thursday morning to confirm that the code for those draws is OK too.
Having done yet another post-midnight update, it struck me that it would be quite easy to extend the cron jobs into the next day (e.g. up until 07:58, which is only 2 minutes before online ticket sales re-open and surely the previous night's results must be out by then [e.g. you'd need to know if it's a rollover or not]?).
What the code needed to do (and I found it quite easy with "date --date yesterday") is that if it's between 00:00 and 07:58, then use yesterday's date/day of the week, which convinces the rest of the code that it's a draw day. I've now made these changes for the main Lotto, Thunderball and Euro Millions auto-scraping. This means any post-midnight official site updates will be replicated within 5 minutes (or 10 minutes for Euro Millions, because that hardly ever releases results beyond midnight).
The irony of this is that after years of manual post-midnight updates, the imminent demise of the live TV show (last one on 7th January 2017) means that the Saturday night draw will be at a fixed time and it probably never be post-22:00 again like it was last night.
I fixed it by also looking for the word "Prize" on the same line as the next draw date, which only occurs for the Euro Millions latest results info. In theory, I could check that two consecutive draws have different numbers (the chance of that not happening is extremely miniscule), but what if they actually didn't?
Previous month: November 2016