Welcome to the Cumulus Support forum.

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

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 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

PHP Script - RealTimeLog PHP Script

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

User avatar
steve
Cumulus Author
Posts: 26701
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: PHP Script - RealTimeLog PHP Script

Post by steve »

bpsmicro wrote:That would be nice, since you already have a timer running. But I wonder if it's not just easier to just generate/append the entire file yourself and eliminate the PHP script need entirely. Just tossing that out as a "perhaps easier" option (probably not, but I mention it anyway).
I don't know how to append using ftp. I think I would have to upload the entire file every time. How big are these things going to get?

Steve

Edit: Ah - ftp does have an 'append' command, I didn't know that. So, yes, I guess that would be the simplest approach. Is the plan that there will be a separate file for each month?
bpsmicro
Posts: 50
Joined: Sat 23 Aug 2008 9:26 pm
Weather Station: Davis Vantage Pro 2 Wireless
Operating System: XP SP3
Location: Merrickville, Ontario, Canada

Re: PHP Script - RealTimeLog PHP Script

Post by bpsmicro »

You're asking the wrong person, but perhaps Kevin will have thoughts on the matter.

Brad.
TNETWeather

Re: PHP Script - RealTimeLog PHP Script

Post by TNETWeather »

bpsmicro wrote:I've been playing with this a bit, so that i could play with the JpGraph stuff. But I'm having a heck of a time finding a suitable mechanism to run .php scripts every minute on a Win2003 server that doesn't involve running what's essentially a DOS program (PHP) in an endless loop and praying that it doesn't negatively effect the server (which is a domain server).
As for the scripts for starters, the current scripts only look for info at a max of every 15 minutes. I use the one minute increment for several purposes, 1) to a make sure I get each of the 15 minute markers 2) I use the data for more than just graphs.

So you could do it every 15 minutes and change the graph code to use every entry it sees rather than looking for specific timestamps (the time might wander).

I am NOT a windows guy, more of a Unix guy and under unix, this is very easy to do with cron. But I do some timed things on my weather workstation which is a WinXP box and it's scheduler is certaintly capable of using once a minute

Image
Just for my own education what's missing in the existing realtime.txt file that the JpGraph stuff can't use (that requires essentially one text file to be parsed into a second text file every minute)?
Is there a prayer this whole "realtime.log" thing could be added in the actual Cumulus program at some point, thus eliminating the need for this script entirely?
The problem there is that you then have to upload an ever increasing data file to your webserver for data that has technically already been sent there. Attempting to use FTP append really depends on whether the FTP server supports it and if you have an FTP client that does as well and my experience has been that is not a dependable method of doing that type of function.

On the web server, you don't have to use the PHP script to do this, you could use Perl, KSH, Bash etc to do the same thing, I've just provided a PHP method. But again, this is an easy thing to do under a Unix based web platform. My original script was written in Perl since I already do this type of function for many other purposes in Perl.
andro700
Posts: 75
Joined: Mon 22 Sep 2008 10:18 pm
Weather Station: Davis VP2
Operating System: Windows 10
Location: Renton, Washington
Contact:

Re: PHP Script - RealTimeLog PHP Script

Post by andro700 »

I have tried setting permissions through Dreamweaver and Filezilla and either one will not let me change permissions not even 777. That is the only file it will not let me changed.

Chuck
Image
TNETWeather

Re: PHP Script - RealTimeLog PHP Script

Post by TNETWeather »

andro700 wrote:I have tried setting permissions through Dreamweaver and Filezilla and either one will not let me change permissions not even 777. That is the only file it will not let me changed.
Chuck

Sounds like a web host issue to me. Don't have an answer for you.
bpsmicro
Posts: 50
Joined: Sat 23 Aug 2008 9:26 pm
Weather Station: Davis Vantage Pro 2 Wireless
Operating System: XP SP3
Location: Merrickville, Ontario, Canada

Re: PHP Script - RealTimeLog PHP Script

Post by bpsmicro »

Thanks for the Windows Scheduler tip. I *knew* I'd seen that option before, but I so rarely use it I'd forgotten where it was. I appear to be appending properly now.
andro700
Posts: 75
Joined: Mon 22 Sep 2008 10:18 pm
Weather Station: Davis VP2
Operating System: Windows 10
Location: Renton, Washington
Contact:

Re: PHP Script - RealTimeLog PHP Script

Post by andro700 »

I use E-rice.net. Maybe I need to write a ticket for it and see if there is an issue.

Chuck
Image
andro700
Posts: 75
Joined: Mon 22 Sep 2008 10:18 pm
Weather Station: Davis VP2
Operating System: Windows 10
Location: Renton, Washington
Contact:

Re: PHP Script - RealTimeLog PHP Script

Post by andro700 »

Well I opened a ticket and this is the answer and fix. It's because realtime.log was created by web scripts, not owned by your FTP user id. I have corrected the file permission set for you. Now it is set with 666 chmod. Now I can get started on the graphs. Should have done this a while ago.

Chuck
Image
andro700
Posts: 75
Joined: Mon 22 Sep 2008 10:18 pm
Weather Station: Davis VP2
Operating System: Windows 10
Location: Renton, Washington
Contact:

Re: PHP Script - RealTimeLog PHP Script

Post by andro700 »

This what I am getting when do the debug. I was wondering what this meant.

Code: Select all

DEBUG MODE ON
Current directory is: /virtual/users/e14497-14796/web/cumulus 
Changing directory to: /virtual/users/e14497-14796/web/cumulus 

Warning: chdir() [function.chdir]: No such file or directory (errno 2) in /virtual/users/e14497-14796/web/cumulus/realtimelog.php on line 93
Current directory is: /virtual/users/e14497-14796/web/cumulus 
Attempting to load: realtime.txt 
We loaded: 1 - Should be 1
Found 43 Fields
Saving Data as: 2008-11-21 08:29:23 26.7 83 22.3 2.0 0.0 198 0.00 0.00 30.04 SSW 1 mph F in in 30.1 -0.02 0.35 1.51 0.00 75.4 19 26.7 +0.9 26.9 08:09 21.4 00:00 16.0 04:09 26.0 04:00 30.33 00:00 30.04 07:56 1.8.3 539 3.0 26.7 -6.2
COMPLETE
Chuck
Image
TNETWeather

Re: PHP Script - RealTimeLog PHP Script

Post by TNETWeather »

It would appear that you don't need to do the chdir, however that would most likely be because you are using the script via a web hit.

If I had a URL to your web site that has the cumulus files I might be able to see more.
andro700 wrote:This what I am getting when do the debug. I was wondering what this meant.

Code: Select all

DEBUG MODE ON
Current directory is: /virtual/users/e14497-14796/web/cumulus 
Changing directory to: /virtual/users/e14497-14796/web/cumulus 

Warning: chdir() [function.chdir]: No such file or directory (errno 2) in /virtual/users/e14497-14796/web/cumulus/realtimelog.php on line 93
Chuck
andro700
Posts: 75
Joined: Mon 22 Sep 2008 10:18 pm
Weather Station: Davis VP2
Operating System: Windows 10
Location: Renton, Washington
Contact:

Re: PHP Script - RealTimeLog PHP Script

Post by andro700 »

Here you go Kevin. Any help would be great.

http://www.chucksweather.com/cumulus/index.htm
Image
TNETWeather

Re: PHP Script - RealTimeLog PHP Script

Post by TNETWeather »

Looks like you have a space at the end of the string?

Code: Select all

$SITE['home']           = "/virtual/users/e14497-14796/web/cumulus ";
At the end of the string after cumulus.
andro700
Posts: 75
Joined: Mon 22 Sep 2008 10:18 pm
Weather Station: Davis VP2
Operating System: Windows 10
Location: Renton, Washington
Contact:

Re: PHP Script - RealTimeLog PHP Script

Post by andro700 »

Kevin here is what I am getting now.

DEBUG MODE ON
Current directory is: /virtual/users/e14497-14796/web/cumulus
Changing directory to: /virtual/users/e14497-14796/web/cumulus
Current directory is: /virtual/users/e14497-14796/web/cumulus
Attempting to load: realtime.txt
We loaded: 1 - Should be 1
Found 43 Fields
Saving Data as: 2008-11-22 12:22:43 36.3 67 26.3 3.0 4.0 193 0.00 0.00 30.01 SSW 1 mph F in in 33.8 -0.03 0.42 1.58 0.07 76.3 21 34.2 +4.9 36.3 12:21 15.9 06:55 7.0 02:15 13.0 02:13 30.15 02:13 30.01 12:00 1.8.4 547 4.0 36.3 -0.5
COMPLETE

Chuck
Image
TNETWeather

Re: PHP Script - RealTimeLog PHP Script

Post by TNETWeather »

So it is working...

If you look in the file: http://www.chucksweather.com/cumulus/realtime.log

you will find data.

Now you need to set it up so that it gets called automatically via cron or some other mechanism an you will be able to use scripts that use the collected log data.
andro700
Posts: 75
Joined: Mon 22 Sep 2008 10:18 pm
Weather Station: Davis VP2
Operating System: Windows 10
Location: Renton, Washington
Contact:

Re: PHP Script - RealTimeLog PHP Script

Post by andro700 »

I can not use cron because e-rice does not support it. Is there something else I can use or otherwise I'm unable to use the graphs.

Chuck
Image
Post Reply