Upload Dayfile: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
(Doc Created)
 
m (added Category)
Line 81: Line 81:


For more advanced control over the your uploads consider using the features in Cumulus [[Toolbox]]
For more advanced control over the your uploads consider using the features in Cumulus [[Toolbox]]
[[Category:WebTools]]

Revision as of 15:39, 10 March 2011

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.

This can be achieve using the Windows Scheduler task (AT) built into Windows XP and above.

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.

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 Windows Scheduler (AT)

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 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 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)


The Windows Scheduler

Now we tell Windows how often to run our script.

  • Click Start, Run and type cmd press Return
  • A black box (command console) will appear
  • Type, or copy:
at 00:10 /every:M,T,W,Th,F,S,Su "c:\cumulus\upload-dayfile.bat"
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 exit or closing the window


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.


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.txt

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