Author Topic: Run Saratoga ajax-dashboard as a CRON job  (Read 2248 times)

0 Members and 1 Guest are viewing this topic.

Offline griffo42

  • Contributor
  • ***
  • Posts: 101
    • Carina Weather
Run Saratoga ajax-dashboard as a CRON job
« on: December 14, 2014, 10:48:06 PM »
Hi

Is there any problem in running the SARATOGA WEATHER ajax-dashboard.php program as a solo CRON job on my web server?  I have included in this program code to extract various timely (5 min) data and so update a MySQL database.  I need to update that database in a timely manner (say 5 min intervals).  At the moment it updates the database whenever someone logs on to my website as doing just that causes the ajax-dashboard.php to run.

One obvious solution would be to update the database by using another program outside the ajax.........php however, as yet, I haven't worked out how to input the 5 min data into a program in useable form.

Any suggestions please?

Keith Griffin
https://www.kstwx.net/index.php
Davis Vantage Pro2 Model #6152AU
Cumulus latest version
Saratoga Weather World template Cumulus plugin
Carina Weather, Brisbane.

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: Run Saratoga ajax-dashboard as a CRON job
« Reply #1 on: December 15, 2014, 02:48:57 AM »
Hi

Is there any problem in running the SARATOGA WEATHER ajax-dashboard.php program as a solo CRON job on my web server?  I have included in this program code to extract various timely (5 min) data and so update a MySQL database.  I need to update that database in a timely manner (say 5 min intervals).  At the moment it updates the database whenever someone logs on to my website as doing just that causes the ajax-dashboard.php to run.

One obvious solution would be to update the database by using another program outside the ajax.........php however, as yet, I haven't worked out how to input the 5 min data into a program in useable form.

Any suggestions please?

Keith Griffin
I use cron for a similar reason,  index.php runs on set intervals using cron.

I attached the script, it is set to run the index.php startpage.

The ob_start and ob_clean functions suppress all output.

So make a testrun first with http://www.kstwx.net/example_cron.php?debug

All output will be shown normally and you can check if all is OK.
Set the cron to run without ?debug.

===

Some  minor "problems":
  • your visitor counters will be affected with all those cronjobs, you can use the $cron_job variable to test in your scripts if the visitor should be counted
  • your 5 minutes database-load interval will be affected by the normal visitors as long as you do not check that also in the scripts

Success, Wim

 

anything