Upload Dayfile: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
m (Added note on Windows 7 privileges)
m (Text replacement - "http://sandaysoft.com/forum/" to "https://cumulus.hosiene.co.uk/")
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Cumulus has the ability to upload files to your webserver at regular intervals, however this is an 'all or nothing' feature -- If Cumulus is set to upload to your website every 10 minutes then every file will be uploaded every 10 minutes.
Cumulus has the ability to upload files to your webserver at regular intervals, however this is an 'all or nothing' feature -- If Cumulus is set to upload to your website every 10 minutes then every file will be uploaded every 10 minutes.


As your website becomes more advanced you may wish additional data available on the site, and the most common need is the [[dayfile.txt]] produces by Cumulus. This is a useful file summarising conditions each day and is used by many Addons and Tools.
As your website becomes more advanced you may wish additional data available on the site, and the most common need is the [[Dayfile.txt]] produces by Cumulus. This is a useful file summarising conditions each day and is used by many Addons and Tools.


The dayfile.txt file only changes once per day therefore it is extremely inefficient to upload this every 10 minutes, far better to do a once per day upload.
The dayfile.txt file only changes once per day therefore it is extremely inefficient to upload this every 10 minutes, far better to do a once per day upload.


Starting with version 1.9.2, Cumulus now has the ability to invoke a command or external program once a day. This is configured via the ''Configuration | Internet Options | External Programs ''dialog box. Whatever is entered in the "Daily" section will be invoked once a day, just after the daily rollover processing is completed.
This can be achieve using the Windows Scheduler task (AT) built into Windows XP and above.


= Automation =
Below are details on how to automate the upload of the dayfile.txt once per day, just after midnight. If your roll over is set to 9/10am you would adjust this to upload just after the roll over. Leave a few minutes at roll over time for Cumulus to complete its work before you upload.


In order to achieve this, we rely on a few components:
= Automation =


*A script for uploading (ftp'ing) the file
In order to achieve this, we rely on a few components:
*A batch file to run the command to upload


* A script for uploading (ftp'ing) the file
== The script ==
* A batch file to run the command to upload
* The Windows Scheduler (AT)


Using a good text editor, such as [http://notepad-plus-plus.org/ Notepad++] or Notepad (if you must!), copy and paste the following into a blank file:
== The script ==
<pre>&lt;user&gt;

&lt;password&gt;
Using a good text editor, such as [http://notepad-plus-plus.org/ Notepad++] or Notepad (if you must!), copy and paste the following into a blank file:
cd &lt;folder&gt;

<pre><user>
<password>
cd <folder>
put c:\cumulus\data\dayfile.txt
put c:\cumulus\data\dayfile.txt
quit
quit
</pre>
</pre>
Replace:

Replace:
* <user> with your ftp login username. This will be the same as the one in Internet Settings in Cumulus Configuration
* <password> with the ftp password. Again, as per the Cumulus Config
* <folder> should be as per 'Directory' in Cumulus

The 'put' entry should be followed by the full path to dayfile.txt on your Cumulus PC

Save this file as <tt>dayfile.ftp</tt> in the Cumulus folder of your PC (example, in c:\Cumulus)


*&lt;user&gt; with your ftp login username. This will be the same as the one in Internet Settings in Cumulus Configuration
*&lt;password&gt; with the ftp password. Again, as per the Cumulus Internet Config
*&lt;folder&gt; should be as per 'Directory' in Cumulus Internet Config


The 'put' entry should be followed by the full path to dayfile.txt on your Cumulus PC
== The Batch file ==


Save this file as <tt>dayfile.ftp</tt> in the Cumulus folder of your PC (example, in c:\Cumulus)
Now create a batch file to use this script. Again in your text editor create a new file (File, New?) and paste the following:


== The Batch file ==
<pre>ftp -s:c:\cumulus\dayfile.ftp <hostname></pre>


Now create a batch file to use this script. Again in your text editor create a new file (File, New?) and paste the following:
Replace
<pre>ftp -s:c:\cumulus\dayfile.ftp &lt;hostname&gt;</pre>
* <hostname> with the same setting in your Cumulus Internet Settings
Replace
* <tt>c:\cumulus\dayfile.ftp</tt> with the full path and filename used when saving the Script file above


*&lt;hostname&gt; with the same setting in your Cumulus Internet Settings
Save this file as <tt>upload-dayfile.bat</tt> in c:\cumulus (or your Cumulus folder if different)
*<tt>c:\cumulus\dayfile.ftp</tt> with the full path and filename used when saving the Script file above


Save this file as <tt>upload-dayfile.bat</tt> in c:\cumulus (or your Cumulus folder if different)


<br>
== The Windows Scheduler ==
== Cumulus settings ==


On the Internet Settings screen, put <tt>c:\cumulus\upload-dayfile.bat</tt> in the Daily box. Leave the params empty.
Now we tell Windows how often to run our script.


*Click Start, Run and type <tt>cmd</tt> press Return
:If you are using Windows 7 you need Admin privileges to set the scheduler. Click Start, All Programs, Accessories. Right Click on 'Command Prompt' and select 'Run as Administrator' You may be asked to confirm this elevation of security privileges (temporarily)
*A black box (command console) will appear
*Type, or copy:
<pre>at 00:10 /every:M,T,W,Th,F,S,Su "c:\cumulus\upload-dayfile.bat"</pre>
: Change the end of the command to the location of the Batch file you created above
: If your roll-over is 9/10am change 00:10 to 10:10 to run the script every dat at 10:10am rather than 10 minutes pas midnight
*Press return
*Type AT and return and you should now see your job listed in the scheduler. Your Job will run every day at the specified time.
*Close the command window by typing <tt>exit</tt> or closing the window




== Running manually ==
There is no notification if the task runs or fails. You need to check the System Event Viewer in the Admin section of the Control Panel for errors.


If you wish to run a manual upload, perhaps to test the command is successful, simply run the batch file:


Start, Run, cmd and type <tt>c:\cumulus\upload-dayfile.bat</tt>
== Running manually ==


Check your webserver for dayfile.txt using your normal ftp tool
If you wish to run a manual upload, perhaps to test the command is successful, simply run the batch file:


== Advanced ==
Start, Run, cmd
and type <tt>c:\cumulus\upload-dayfile.txt</tt>


For more advanced control over the your uploads consider using the features in Cumulus [[Toolbox]]
Check your webserver for dayfile.txt using your normal ftp tool


<br>
== Advanced ==


== Possible Issues ==
For more advanced control over the your uploads consider using the features in Cumulus [[Toolbox]]


The FTP tool being used here is the one which ships with Windows; it is a relatively simply implementation and may not support the requirements of your webserver. There is some useful reading in [https://cumulus.hosiene.co.uk/viewtopic.php?f=18&t=4821 this] forum topic which may help if you have issues.


[[Category:WebTools]]
[[Category:WebTools]]

Latest revision as of 15:54, 2 November 2018

Cumulus has the ability to upload files to your webserver at regular intervals, however this is an 'all or nothing' feature -- If Cumulus is set to upload to your website every 10 minutes then every file will be uploaded every 10 minutes.

As your website becomes more advanced you may wish additional data available on the site, and the most common need is the Dayfile.txt produces by Cumulus. This is a useful file summarising conditions each day and is used by many Addons and Tools.

The dayfile.txt file only changes once per day therefore it is extremely inefficient to upload this every 10 minutes, far better to do a once per day upload.

Starting with version 1.9.2, Cumulus now has the ability to invoke a command or external program once a day. This is configured via the Configuration | Internet Options | External Programs dialog box. Whatever is entered in the "Daily" section will be invoked once a day, just after the daily rollover processing is completed.

Automation

In order to achieve this, we rely on a few components:

  • A script for uploading (ftp'ing) the file
  • A batch file to run the command to upload

The script

Using a good text editor, such as Notepad++ or Notepad (if you must!), copy and paste the following into a blank file:

<user>
<password>
cd <folder>
put c:\cumulus\data\dayfile.txt
quit

Replace:

  • <user> with your ftp login username. This will be the same as the one in Internet Settings in Cumulus Configuration
  • <password> with the ftp password. Again, as per the Cumulus Internet Config
  • <folder> should be as per 'Directory' in Cumulus Internet Config

The 'put' entry should be followed by the full path to dayfile.txt on your Cumulus PC

Save this file as dayfile.ftp in the Cumulus folder of your PC (example, in c:\Cumulus)

The Batch file

Now create a batch file to use this script. Again in your text editor create a new file (File, New?) and paste the following:

ftp -s:c:\cumulus\dayfile.ftp <hostname>

Replace

  • <hostname> with the same setting in your Cumulus Internet Settings
  • c:\cumulus\dayfile.ftp with the full path and filename used when saving the Script file above

Save this file as upload-dayfile.bat in c:\cumulus (or your Cumulus folder if different)


Cumulus settings

On the Internet Settings screen, put c:\cumulus\upload-dayfile.bat in the Daily box. Leave the params empty.


Running manually

If you wish to run a manual upload, perhaps to test the command is successful, simply run the batch file:

Start, Run, cmd and type c:\cumulus\upload-dayfile.bat

Check your webserver for dayfile.txt using your normal ftp tool

Advanced

For more advanced control over the your uploads consider using the features in Cumulus Toolbox


Possible Issues

The FTP tool being used here is the one which ships with Windows; it is a relatively simply implementation and may not support the requirements of your webserver. There is some useful reading in this forum topic which may help if you have issues.