112.5 °F

Hum: 19% Dew: 60.5 °F
Baro: 1001.43 hPa
Wind: SW @ 2.4 mph
Rain: No Rain Today
Data Updated: 17:11
TNET Weather Station - Mesa, AZ USA
Home   Forecasts   Graphs   Radar   Trends   Webcams   Weather Links   Archives   PROJECTS & SCRIPTS   About Us
TNET Weather Based Projects and Scripts > Cumulus RealTimeLog Rotate Script

Cumulus RealTimeLog Rotate Script

This is designed to work with the realtime.log files that are generated by this project: Cumulus RealTimeLog Script. That project creates realtime.log files from the realtime.txt files uploaded to the server by Cumulus, but it doesn't ever trim the file.

This script does that. I took my existing script that rotates my realtime.log files and pulled it out of my system. All of my scripts use common config scripts to get names, places, files, folders, timezones, configs, colors and even common functions... So the result is not as tidy as the original script, but I really can't distribute the script with my configs in it.


What it Does

You should like I do, only run this once a month since it will only generate the archive files if the current month is newer than data in the logfile. Personally, I run it from cron on the 4th day of the month after midnight. This ensures there is 48 hours worth of data that I use for charts, trends and things.


If you are running this via CLI, you most likely don't need to deal with this. As your cron will most likely run as you and the files you have are owned by you.

If however, you use this via the web, the web server needs to be able to write to the files.

Specifically... Whatever you use for the archive directory most likely should have 0777 (rwxrwxrw) permissions (Note this is a directory, NOT a file). This will allow the webserver to write to new files in the directory.

The realtime.log needs to most likely need to be 0666 (rw-rw-rw-) permissions.


The following settings are used...

Timezone Setting

Your Timezone - Ref: http://php.net/manual/en/timezones.php
$SITE['timezone']       =    'America/Phoenix';

Location of your realtime.log

Location of your realtime.log file. If the script is in the same dir as the log this should be okay.
$SITE['realtime_log']  =    './realtime.log';

Location of your Archive directory.

Location of your archive data. If you don't have one, you will need to create it (See permissions above)
$SITE['archive_dir']   =    './archives/';

Secret Code to Prevent Unwanted Runs

The Secret Code... If you use the script via the WEB, you need to set this to a set of numbers. Letters don't work.
$SITE['codeval']       =    intval('SET_ME_PLEASE');


If you are trying this for the first time, PLEASE make sure you backup your realtime.log file yourself somewhere so that if it messes it up, you can recover from it. The script does make a backup, but if that file fails you may end up without any of your historical data in the realtime.log.

Backups are a smart thing to do.... Be smart!

Copyright © 2017 TNET Systems Inc. - All rights reserved. Weather Collection for this website is done via Cumulus 1.9.4 build #1093 and Weather Display
Boltwire Cumulus Plugin by TNET using Boltwire v3.4.16 Hosting by TNET
IP: [ec2-54-81-154-223.compute-1.amazonaws.com] - Views #57