Page 2 of 4
Re: PHP Script - RealTimeLog PHP Script
Posted: Sun 09 Nov 2008 4:08 pm
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?
Re: PHP Script - RealTimeLog PHP Script
Posted: Sun 09 Nov 2008 4:28 pm
by bpsmicro
You're asking the wrong person, but perhaps Kevin will have thoughts on the matter.
Brad.
Re: PHP Script - RealTimeLog PHP Script
Posted: Sun 09 Nov 2008 5:00 pm
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
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.
Re: PHP Script - RealTimeLog PHP Script
Posted: Sun 09 Nov 2008 9:20 pm
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
Re: PHP Script - RealTimeLog PHP Script
Posted: Sun 09 Nov 2008 9:24 pm
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.
Re: PHP Script - RealTimeLog PHP Script
Posted: Sun 09 Nov 2008 10:22 pm
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.
Re: PHP Script - RealTimeLog PHP Script
Posted: Mon 10 Nov 2008 5:14 am
by andro700
I use E-rice.net. Maybe I need to write a ticket for it and see if there is an issue.
Chuck
Re: PHP Script - RealTimeLog PHP Script
Posted: Thu 20 Nov 2008 12:28 am
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
Re: PHP Script - RealTimeLog PHP Script
Posted: Fri 21 Nov 2008 3:31 pm
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
Re: PHP Script - RealTimeLog PHP Script
Posted: Fri 21 Nov 2008 4:00 pm
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
Re: PHP Script - RealTimeLog PHP Script
Posted: Sat 22 Nov 2008 1:22 am
by andro700
Re: PHP Script - RealTimeLog PHP Script
Posted: Sat 22 Nov 2008 7:19 pm
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.
Re: PHP Script - RealTimeLog PHP Script
Posted: Sat 22 Nov 2008 7:23 pm
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
Re: PHP Script - RealTimeLog PHP Script
Posted: Sat 22 Nov 2008 7:46 pm
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.
Re: PHP Script - RealTimeLog PHP Script
Posted: Sat 22 Nov 2008 8:11 pm
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