Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

Meteotemplate cron job for Cumulus realtime.txt

Topics about the Beta trials up to Build 3043, the last build by Cumulus's founder Steve Loft. It was by this time way out of Beta but Steve wanted to keep it that way until he made a decision on his and Cumulus's future.

Moderator: mcrossley

Locked
stefanbagnato
Posts: 159
Joined: Sun 08 May 2016 9:11 pm
Weather Station: Vantage Pro 2
Operating System: Windows Server 2019
Location: Raleigh, NC

Meteotemplate cron job for Cumulus realtime.txt

Post by stefanbagnato »

Hi All,

I am working on a getting the cron job for the data update from CumulusMX to Meteotemplate working. Currently, the realtime.txt file is in C:\CumulusMX. So, in the cumulus.php file in meteotemplate's update folder, I list the relative path as C:\CumulusMX\realtime.txt. When I run the script/cron job, it throws an error:


Latest DB record timestamp detected: 1969-12-31 19:00:00
Latest cached timestamp detected: 1969-12-31 19:00:00
Smallest interval between uploads to database set to: 60 seconds.
Difference between latest db timestamp and cached timestamp: 0 seconds.
The difference between last db update and current data is not yet larger than the set interval. Current data is saved into temporary cache.

I went into myPHPAdmin and created a fake line of data. When I reran the script, I get:

Latest DB record timestamp detected: 2016-06-28 20:40:00
Latest cached timestamp detected: 1969-12-31 19:00:00
Smallest interval between uploads to database set to: 300 seconds.
Difference between latest db timestamp and cached timestamp: -1467160800 seconds.
The difference between last db update and current data is not yet larger than the set interval. Current data is saved into temporary cache.

So, it knows there is something in the database, but still can't write anything anywhere including to the cache. Next, I copied the latest realtime.txt into \wwwroot\update and set the path in cumulus.php to "realtime.txt". I reran the script again, and it worked.

So, my question is, barring a permissions issue (my account has full access to C:\CumulusMX so I wouldn't think it would be..), what else might be the problem with my setup?

FYI, my station is a VP2, and I am using Server 2012 R2 with IIS on my personal server.
User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Meteotemplate cron job for Cumulus realtime.txt

Post by steve »

I know nothing at all about how Meteotemplate works, but presumably the cumulus.php script runs on the server, not on your local PC? You're giving it the location of the realtime.txt file on your PC rather than the server, are you not? I think you need to be giving it the location on your server. Even though the server is IIS (and perhaps it is actually the same machine as is running Cumulus?) I don't think you can supply a path in a PHP script in the form C:\... I think it has to involve the wwwroot rather than the Windows filestore, that's all the web server understands.

But I could be wrong...
Steve
stefanbagnato
Posts: 159
Joined: Sun 08 May 2016 9:11 pm
Weather Station: Vantage Pro 2
Operating System: Windows Server 2019
Location: Raleigh, NC

Re: Meteotemplate cron job for Cumulus realtime.txt

Post by stefanbagnato »

Hi Steve

I think I understand what you are saying. The server and PC are one in the same. But I get the notion that the wwwroot folder is separate in a sense. I don't have access to Cumulus at this moment, otherwise I would look myself, but is there an ability in Cumulus to specify the location of the realtime.txt file? So instead of saving it to C:\CumulusMX, saving it somewhere else (as in the wwwroot)? Alternatively, I could probably write something to run a continuous (maybe to the minute?) copy of the file in C:\CumulusMX to the correct location in wwwroot. Hopefully that makes sense..
User avatar
PaulMy
Posts: 4355
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Meteotemplate cron job for Cumulus realtime.txt

Post by PaulMy »

I may be misunderstanding your issue, but if you have Cumulus realtime.txt on your webserver then the /update/cumulus.php?password=xxxxx should be taking data from realtime.txt and upload to the alldata MySQL database used by Meteotemplate. The Metetemplate setup.php is where you set the path to realtime.txt. I have Cumulus Toolbox uploading realtime.txt to my webserver http://www.komokaweather.com/weather/realtime.txt. For my Meteotemplate setup I have a cron-job running http://www.komokaweather.com/j-template ... word=xxxxx at 5 minute interval http://www.komokaweather.com/j-template
So instead of saving it to C:\CumulusMX, saving it somewhere else
For another template I have created a second duplicated realtime.txt (realtimeT.txt) to be processed and uploaded as realtime.txt by Cumulus to another specific folder accessed by this alternate template.

Paul
VP2+
C1 www.komokaweather.com/komokaweather-ca
MX https://komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX https://komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX https:// komokaweather.com/cumulusmx4/index.htm
Image
User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Meteotemplate cron job for Cumulus realtime.txt

Post by steve »

stefanbagnato wrote:is there an ability in Cumulus to specify the location of the realtime.txt file? So instead of saving it to C:\CumulusMX, saving it somewhere else (as in the wwwroot)?
You can add it to the extra web files, and specify the current and required locations (including the actual file name), tick 'realtime', but not 'ftp' or 'process'. It will then copy the file each time.
Steve
stefanbagnato
Posts: 159
Joined: Sun 08 May 2016 9:11 pm
Weather Station: Vantage Pro 2
Operating System: Windows Server 2019
Location: Raleigh, NC

Re: Meteotemplate cron job for Cumulus realtime.txt

Post by stefanbagnato »

Awesome! That works. I had written a batch file to copy the file over every minute. But this is easier. The other I was having that I am currently working on is that I set a scheduled task in Server 2012 to run the http://localhost/update/cumulus.php?pass=XXXXXXX to run every minute, as the steps Jachym wrote say. But, when mine would run, a pop-up comes up:

How do you want to open this type of link (http)?
Keep using Internet Explorer

Obviously my default browser is IE. The only want I have found around it so far is to write a script to open IE and then run the task.

START "" "C:\Program Files (x86)\Internet Explorer\iexplore.exe" "http://localhost/update/cumulus.php?pass=XXXXX"

The issue with that is that it keeps opening more instances of IE and not using the same one. I am working on a script to kill off that instance (so I can keep Cumulus running in a separate window) that kills it by the window title name, it just is not working yet...

@echo off
timeout /t 3
taskkill /FI "WINDOWTITLE eq localhost*"


****UPDATE****

I got that script to work now. Still seems odd that I have to use it though. Anybody else on a Windows platform have that default programs problem??
exit

****UPDATE #2****

So I decided to see if it was just the cumulus.php causing that IE prompt, or all. I ran the script with install/setup.php, and same thing. So, that rules out any issue with the specific script. Same question though; does anybody else on a Windows platform have the default programs problem?
User avatar
PaulMy
Posts: 4355
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Meteotemplate cron job for Cumulus realtime.txt

Post by PaulMy »

I use https://www.cron-job.org/en/ for /update/cumulus.php?password=xxxxx

Meteotemplate and IE are not a good mix. If you are having problems try another browser.

Paul
VP2+
C1 www.komokaweather.com/komokaweather-ca
MX https://komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX https://komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX https:// komokaweather.com/cumulusmx4/index.htm
Image
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Meteotemplate cron job for Cumulus realtime.txt

Post by mcrossley »

I may be missing something here (reading this on my phone), but if your web server and scheduled task are on the same machine, why are you messing around with calling http URLs?

Just call the PHP script directly, with <pathtophp>PHP.exe <pathtoscript>script name.php <scriptparams>

The format for passing the parameters changes slightly for the CLI from URL, but it is a much neater approach. It is how I did it on my old windows server, and via a cron job on the rPi.

In the old CumulusSQL script the header gives instructions for calling it via a URL or CLI.
Locked