Welcome to the Cumulus Support forum.

Latest Cumulus MX release v3.2.4 build 3060 - 10 December 2019.
    Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014

    See the Wiki for downloading either version.

    Saratoga templates on Raspberry PI

    Discussion of Ken True's web site templates

    Moderator: saratogaWX

    Post Reply
    Adrian Hudson
    Posts: 216
    Joined: Mon 03 Jan 2011 4:27 pm
    Weather Station: Davis Vantage Pro2
    Operating System: Win 7
    Location: Willand, mid Devon.
    Contact:

    Saratoga templates on Raspberry PI

    Post by Adrian Hudson » Sun 18 Sep 2016 1:51 pm

    Hi,
    I reckon this is a simple problem but I am darned if I know whats going on.

    I am porting my website from Windows to RPI and its going okay - ish. One problem I don't seem to be able to get over is the templates not finding my realtime.txt file. Here is a line from the Apache log:

    ... 14:26:49 +0100] "GET /realtime.txt?1474205210632 HTTP/1.1" 404 508 "http://weatherpi/wxgraphs.php" ...

    404 shows the file is not found but it IS there in the folder (and all lowercase, in case anyone is wondering). What is the significance of the number after the question mark? I half remember something about this being something to do with ensuring a fresh copy of realtime.txt is obtained every request but I can't for the life of me remember where that number comes from or what it means or if it is anything to do with the file not being found.

    Can anyone help please?

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

    Re: Saratoga templates on Raspberry PI

    Post by steve » Sun 18 Sep 2016 2:06 pm

    It's a pseudo-random number usually based on the current date ad time, to stop any caching happening. It could be that your web server doesn't like the extra bit added on. I'm afraid I have no idea what you need to do to it if that is the case, but I'm sure someone who knows what they're talking about will be along shortly. I'll get back to packing the RV...
    Steve

    Adrian Hudson
    Posts: 216
    Joined: Mon 03 Jan 2011 4:27 pm
    Weather Station: Davis Vantage Pro2
    Operating System: Win 7
    Location: Willand, mid Devon.
    Contact:

    Re: Saratoga templates on Raspberry PI

    Post by Adrian Hudson » Sun 18 Sep 2016 3:03 pm

    Thanks Steve. The problem doesn't seem to be anything to do with this number in the url. I just requested the realtime.txt manually from a web browser and the pi responded with the file, whether or not I appended a question mark and a number. So, I'm stumped.

    I have tried

    $SITE['realtimefile'] = './realtime.txt'; // directory and name of Cumulus realtime.txt file

    and

    $SITE['realtimefile'] = 'realtime.txt'; // directory and name of Cumulus realtime.txt file

    in Settings-weather.php

    neither works.

    I'm guessing its something to do with case sensitivity of filenames on linux but I am darned if I can find it!

    jlmr731
    Posts: 135
    Joined: Sat 27 Aug 2016 12:11 am
    Weather Station: Davis vantage pro 2
    Operating System: Debian
    Location: Youngstown, Ohio
    Contact:

    Re: Saratoga templates on Raspberry PI

    Post by jlmr731 » Sun 18 Sep 2016 5:24 pm

    Now im not using a RPI but i am on a linux system and in my Setting-weather.php i use the absolute path to my realtime file.
    Also i am grabbing it from the CumulusMX program dir since it is running on the linux system like /home/me/CumulusMX/realtime.txt
    Now if your uploading the realtime.txt to your pi into the web dir try using that say /var/www/realtime.txt or wherever your web root is
    For me i have always found using the full path works best. and yes everything is case sensitive
    Hope this helps you

    Adrian Hudson
    Posts: 216
    Joined: Mon 03 Jan 2011 4:27 pm
    Weather Station: Davis Vantage Pro2
    Operating System: Win 7
    Location: Willand, mid Devon.
    Contact:

    Re: Saratoga templates on Raspberry PI

    Post by Adrian Hudson » Sun 18 Sep 2016 6:09 pm

    @jlmr731

    Many thanks for your suggestion. I am embarrassed to say I had the whole site in a subfolder of \www\html and had forgotten! Quoting the whole path indeed fixed it! Thanks.

    User avatar
    saratogaWX
    Posts: 1003
    Joined: Wed 06 May 2009 5:02 am
    Weather Station: Davis Vantage Pro Plus
    Operating System: Windows 10 Professional
    Location: Saratoga, CA, USA
    Contact:

    Re: Saratoga templates on Raspberry PI

    Post by saratogaWX » Sun 18 Sep 2016 9:42 pm

    It was likely a request created by ajaxCUwx.js JavaScript. If your website is not located in the document root, then you need to change ajaxCUwx.js

    Code: Select all

    var realtimeFile = '/realtime.txt'; //  URL location of realtime.txt relative to document root of website
    
    to

    Code: Select all

    var realtimeFile = './realtime.txt'; //  URL location of realtime.txt relative to document root of website
    
    or

    Code: Select all

    var realtimeFile = 'realtime.txt'; //  URL location of realtime.txt relative to document root of website
    
    to have it come from the same directory as the template. The Settings.php settin for

    Code: Select all

    $SITE['realtimefile'] = 'realtime.txt'; // directory and name of Cumulus realtime.txt file
    applies to the PHP parts of the template.. the ajaxCUwx.js has to be changed separately.

    Post Reply