Author Topic: 'Rain Yesterday ' not accurate.  (Read 745 times)

0 Members and 1 Guest are viewing this topic.

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6878
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: 'Rain Yesterday ' not accurate.
« Reply #25 on: December 05, 2018, 07:22:22 PM »
I did a saveYesterday.php on your site and forced a collection just to check that the script was running correctly (if invoked).  It ran fine and saved today's values at that time to yesterday's values.

So the problem seems to be with trying to run the script via cron.  Do you have an email address in cPanel to receive the errors if a cron job fails.. if not, please add it.

On my GoDaddy cPanel site, /usr/bin/php is PHP 7.2 so try:

cd $HOME/public_html;/usr/bin/php -q saveYesterday.php >> cache/LOG_saveYesterday.php.txt

as the command.. if it fails, then, we'll have to use a cron batch file instead (and that's a bit trickier to make work as the batch files have to only have \n (new-line) characters, and \r\n (carriage-return,new-line) like windows uses will blow up a batch job).

Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Stryder87

  • Senior Member
  • **
  • Posts: 64
    • Moody Weather
Re: 'Rain Yesterday ' not accurate.
« Reply #26 on: December 05, 2018, 08:36:20 PM »
Yes, I added my email a few days ago, but it doesn't seem to send out emails reliably.  I got one in the last week.

I've changed the cron job to be what you suggested.  Let's see what happens tomorrow.

Sorry for all this trouble.   :oops:

Offline Stryder87

  • Senior Member
  • **
  • Posts: 64
    • Moody Weather
Re: 'Rain Yesterday ' not accurate.
« Reply #27 on: December 06, 2018, 02:19:40 PM »
Ok, so it looks like 'cd $HOME/public_html;/usr/bin/php -q saveYesterday.php >> cache/LOG_saveYesterday.php.txt' didn't work.  Strangely enough, there are a couple errors listed on the Network Status/View Log page.  Not sure what they are referring to.  They seemed to show up after I had turned on showing PHP errors on the PHP configuration page in CPanel.  I've since turned that off.

Just wondering, in the command you had me try, there's no space between 'public_html;' and 'usr/bin...'.  Should there be one?  Looking at the examples they list, it looks like there should be a space there.  Maybe it's just a simple typo now?

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6878
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: 'Rain Yesterday ' not accurate.
« Reply #28 on: December 06, 2018, 03:15:14 PM »
No, the space between public_html;/usr/bin/php shouldn't matter.

Is your full cron entry like:

Code: [Select]
58 * * * * cd $HOME/public_html;/usr/bin/php -q saveYesterday.php >> cache/LOG_saveYesterday.php.txt
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Stryder87

  • Senior Member
  • **
  • Posts: 64
    • Moody Weather
Re: 'Rain Yesterday ' not accurate.
« Reply #29 on: December 06, 2018, 04:20:18 PM »
59 23 * * * cd $HOME/public_html;/usr/bin/php -q saveYesterday.php >> cache/LOG_saveYesterday.php.txt

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6878
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: 'Rain Yesterday ' not accurate.
« Reply #30 on: December 06, 2018, 04:54:06 PM »
Ahh... there's the issue.  Change it to

59 * * * * cd $HOME/public_html;/usr/bin/php -q saveYesterday.php >> cache/LOG_saveYesterday.php.txt

It will run once per hour (at :59), but only save if the LOCAL TIME (based on your timezone setting) is in hour=23.

Your setting of 59 23 * * * meant run it at the SERVER time of 23:59, which is likely not the same timezone as your site, so the script ran and just ignored the save request as it wasn't 23:59 in your timezone.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Stryder87

  • Senior Member
  • **
  • Posts: 64
    • Moody Weather
Re: 'Rain Yesterday ' not accurate.
« Reply #31 on: December 06, 2018, 05:30:35 PM »
And yet it had worked for a while....   :?

Ok, changed.  Now the waiting again...   :lol:

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6878
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: 'Rain Yesterday ' not accurate.
« Reply #32 on: December 07, 2018, 12:39:28 AM »
And.... I can see it running hourly, but an error message is coming out in the log
Quote
<br />
<b>Warning</b>:  session_start(): Cannot start session when headers already sent in <b>/home/d6bsim7o954q/public_html/include-style-switcher.php</b> on line <b>31</b><br />

This is caused by a trailing space in the last line of both Settings.php and common.php .. change BOTH from
Code: [Select]
?> to be
Code: [Select]
# -- end and that should stop the premature header caused by the rogue space(s) and thereby stop that error message in the log.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Stryder87

  • Senior Member
  • **
  • Posts: 64
    • Moody Weather
Re: 'Rain Yesterday ' not accurate.
« Reply #33 on: December 07, 2018, 11:24:27 AM »
Yup, looks like it ran to me, too. I've replaced the last line in both files with '# -- end'.  I'm going to delete the LOG_saveTesterday.php.txt file to make it easier to see anything that may now come up (I'll keep a copy just in case).

If everything looks good over the next couple of days, I'll put the '2> /dev/null' back in at the end of the cron job line.

I think I'm going to start a new thread to get some assistance with the huge amount of 'Undefined variable/offset/index' errors I'm seeing in the error_log.  They are mostly in the ajax-dashboard.php and AWNtags.php files with a couple ajax-gizmo.php lines.


Thanks for all the help with this one.  I really wish GoDaddy would be a little more informative when they make changes and how it could affect one's site.  The job had been running fine for quite a while.

Offline Stryder87

  • Senior Member
  • **
  • Posts: 64
    • Moody Weather
Re: 'Rain Yesterday ' not accurate.
« Reply #34 on: December 08, 2018, 12:35:29 PM »
And.... I can see it running hourly, but an error message is coming out in the log
Quote
<br />
<b>Warning</b>:  session_start(): Cannot start session when headers already sent in <b>/home/d6bsim7o954q/public_html/include-style-switcher.php</b> on line <b>31</b><br />

This is caused by a trailing space in the last line of both Settings.php and common.php .. change BOTH from
Code: [Select]
?> to be
Code: [Select]
# -- end and that should stop the premature header caused by the rogue space(s) and thereby stop that error message in the log.

I made these changes, but I'm seeing this error again.

It's mentioning line 31 in 'include-style-switcher.php'... which says '    session_start();'.
I notice that the last line in this file is the same as the other two you had me change.  Should I change this file too?


Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6878
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: 'Rain Yesterday ' not accurate.
« Reply #35 on: December 08, 2018, 12:58:24 PM »
Yes, give it a try.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Stryder87

  • Senior Member
  • **
  • Posts: 64
    • Moody Weather
Re: 'Rain Yesterday ' not accurate.
« Reply #36 on: December 11, 2018, 11:13:40 AM »
So it looks like the cron job is successfully up and running again.  I'm still getting those weird session header errors though.  I adjusted all of the files you mentioned, but it's still throwing them.  I think I'm going to put the ' 2> /dev/null' back on the end of the cron job command line and see if that stops the errors.

Offline Stryder87

  • Senior Member
  • **
  • Posts: 64
    • Moody Weather
Re: 'Rain Yesterday ' not accurate.
« Reply #37 on: December 12, 2018, 11:46:53 AM »
Ok, so I put that flag back into the cron job command line, but I'm still getting 2 instances of the 'Cannot start session when headers' issue, one set of 16 lines before the line saying the job ran and another 8 lines after the job runs.

I've fixed all of the files mentioned earlier (where it seemed to need it), so I'm rather stumped on what it means.