Page 1 of 2

Secure FTP

Posted: Sat 23 Feb 2013 6:25 pm
by wxbear73
Is there any way to get the software to upload data using SSL/TLS secure FTP? My website is hosted by Yahoo and their FTP options have changed to only allowing secure FTP uploads now.

Re: Secure FTP

Posted: Sat 23 Feb 2013 6:35 pm
by steve
It's not currently built in to Cumulus, but see the wiki for a way you can achieve it: http://wiki.sandaysoft.com/a/SFTP

Re: Secure FTP

Posted: Mon 25 Feb 2013 7:46 pm
by wxbear73
OK I have created a script as follows and I have placed the following link in the Program box of External Programs in Cumulus (c:\Program Files (x86)\Cumulus\script.txt) but nothing is happening. I have probably missed something somewhere but any help would be appreciated.

open "Wxbear73"
option batch abort
option confirm off
open wxbear73@weathermansworld.com:xxxxxxxx@ftp://ftp.weathermansworld.com
put "C:\Program Files (x86)\Cumulus\realtime.txt" /realtime.txt
put "C:\Program Files (x86)\Cumulus\web\index.htm"/index.htm
put "C:\Program Files (x86)\Cumulus\web\today.htm"/today.htm
put "C:\Program Files (x86)\Cumulus\web\yesterday.htm"/yesterday.htm
put "C:\Program Files (x86)\Cumulus\web\record.htm"/record.htm
put "C:\Program Files (x86)\Cumulus\web\trends.htm"/trends.htm
put "C:\Program Files (x86)\Cumulus\web\gauges.htm"/gauges.htm
put "C:\Program Files (x86)\Cumulus\web\thismonth.htm"/thismonth.htm
put "C:\Program Files (x86)\Cumulus\web\thisyear.htm"/thisyear.htm
put "C:\Program Files (x86)\Cumulus\web\images\wind.png" /images/wind.png
put "C:\Program Files (x86)\Cumulus\web\images\rain.png" /images/rain.png
put "C:\Program Files (x86)\Cumulus\web\images\press.png" /images/press.png
put "C:\Program Files (x86)\Cumulus\web\images\temp.png" /images/temp.png
put "C:\Program Files (x86)\Cumulus\web\images\windd.png" /images/windd.png
put "C:\Program Files (x86)\Cumulus\web\images\raint.png" /images/raint.png
put "C:\Program Files (x86)\Cumulus\web\images\tempm.png" /images/tempm.png
put "C:\Program Files (x86)\Cumulus\web\images\raind.png" /images/raind.png
put "C:\Program Files (x86)\Cumulus\web\images\windsm.png" /images/windsm.png
put "C:\Program Files (x86)\Cumulus\web\images\rainsm.png" /images/rainsm.png
put "C:\Program Files (x86)\Cumulus\web\images\presssm.png" /images/presssm.png
put "C:\Program Files (x86)\Cumulus\web\images\tempsm.png" /images/tempsm.png
put "C:\Program Files (x86)\Cumulus\web\images\winddsm.png" /images/winddsm.png
put "C:\Program Files (x86)\Cumulus\web\images\raintsm.png" /images/raintsm.png
put "C:\Program Files (x86)\Cumulus\web\images\tempmsm.png" /images/tempmsm.png
put "C:\Program Files (x86)\Cumulus\web\images\raindsm.png" /images/raindsm.png
put "C:\Program Files (x86)\Cumulus\web\images\windrose.png" /images/windrose.png
put "C:\Program Files (x86)\Cumulus\web\images\windgauge.png" /images/windgauge.png
put "C:\Program Files (x86)\Cumulus\web\images\compass.png" /images/compass.png
put "C:\Program Files (x86)\Cumulus\web\images\moon.bmp" /images/moon.bmp
put "C:\Program Files (x86)\Cumulus\web\images\intemp.png" /images/intemp.png
put "C:\Program Files (x86)\Cumulus\web\images\hum.png" /images/hum.png
put "C:\Program Files (x86)\Cumulus\web\images\intempsm.png" /images/intempsm.png
put "C:\Program Files (x86)\Cumulus\web\images\humsm.png" /images/humsm.png
exit

Re: Secure FTP

Posted: Mon 25 Feb 2013 7:57 pm
by steve
I know very little about how this works (I didn't write those instructions), but what is that first line for? I can't see that in the instructions. Also, do you have 'auto update' selected?

I don't think this can be correct: "ftp://ftp.weathermandsworld.com" as that would imply you're using ftp, which you're not. Shouldn't that just be "ftp.weathermandsworld.com", or even "ftp.weathermansworld.com"?

Other people are using this, I'm sure someone who understands it will be along to help shortly.

Re: Secure FTP

Posted: Mon 25 Feb 2013 10:17 pm
by mcrossley
I just read the wiki page, I think it was missing some key information. I have added some extra details, hopefully it makes more sense now. (I have never used this technique though)

Steve is right though, your text script doesn't look quite right.

Re: Secure FTP

Posted: Mon 25 Feb 2013 10:34 pm
by wxbear73
Thanks for editing my post to remove the password by the way. I didn't even notice it was in there when I posted.
The Open "Wxbear73" is the name of the WinSCP profile that I created with the login information. I tried removing
that since the login info is already in the batch file.

I will look at the wiki again and see if I can figure out what I'm doing wrong in the mean time. I have Auto Update
checked and an interval of every 5 minutes but not sure it is doing anything. I am not sure what log file if any it
would report whether the executing of the external program was working or not.

Re: Secure FTP

Posted: Tue 26 Feb 2013 7:38 am
by steve
Any error messages would be logged to the current diags file. But for there to be anything useful there, it would rely on Windows returning something useful from ShellExecute().

Re: Secure FTP

Posted: Tue 26 Feb 2013 8:45 am
by mcrossley
Its possible the winscp program could output some messages, so you could modify the batch file to attempt to capture them to a log file...

Code: Select all

winscp.com /script=c:\cumulus\sftp-cmds.txt  2>&1 >c:\cumulus\sftp-log.txt

Re: Secure FTP

Posted: Wed 27 Feb 2013 1:04 am
by wxbear73
I am still not getting anything to upload and no indication from any logs that it is even trying. I have to assume that something is missing somewhere...either in the external program call in Cumulus, or one of the batch files. Any further ideas on what I might be missing would be appreciated.

Re: Secure FTP

Posted: Wed 27 Feb 2013 2:09 am
by BCJKiwi
Well I don't use winscp but a different FTP program so I have been reluctant to make suggestions as I cannot verify them from direct experience.
However I think I may have identified a few issues and I would like to suggest a way to test where the problem may be.

A quick look at the winscp page and info suggests the program can be run manually as well as from the command line so;
1. run the program manually and ensure the user name/password protocol etc all work manually to connect to your server.
You can change the settings until you can see the connection is working.
2. once you have this working - apply those settings to the automation method.

3. Back in the manual mode, try transferring a file and make sure you can actually upload the file to the right place - again check the full path of the process (both source and destination) - they should be displayed somewhere - and transfer this to your batch file.

4. the destination as shown in your script above is missing all the path info in the destination part of the each line.
i.e. after the / you only have the file name so winscp will be trying to put the file where? - see 3. above, you will need the full path in each line of the batch file for the destination (i.e. server/folder/folder/file.ext) as determined in step 3.
Try with one file to begin with and check that it is uploading properly. Once you have that working you can add the others.

5. If you can do it all manually but not automatically and you are sure all the ftp stuff is set properly, then you will need to check that Cumulus is set properly to provide the right files in the right places at the right times. Check the places the files are and check their dates to see that new files are being generated each time (or delete them and ensure they are re-created at the right time(s)

Also Steve strongly recommends Cumulus is installed directly into C:\ not into "program files".
This would avoid all the issues around having to include the filespec in " "s and likely improve reliability. There are a number of issues using 'Dos' (i.e. batch file) techniques in Windows as some things just don't work as expected. So the simpler you can make the better.

Re: Secure FTP

Posted: Wed 27 Feb 2013 2:46 am
by wxbear73
I have verified that everything is working properly using WinSCP manually but something is still amiss in the scripts somewhere.

In Cumulus, I have Auto Update checked and the following line for Program in External Programs:
c:\Program Files (x86)\Cumulus\sftp.bat

>>I am wondering if I need any params specified to make it run that program?

sftp.bat contains the following:

winscp.com /script=c:\Program Files (x86)\Cumulus\script.txt 2>&1 >c:\Program Files (x86)\Cumulus\sftp-log.txt

>>sftp-log.txt is never created so no help there.

script.txt contains the following:

option batch abort
option confirm off
open wxbear73:xxxxxxxx@weathermansworld.com
put "C:\Program Files (x86)\Cumulus\realtime.txt" weathermansworld.com/realtime.txt
put "C:\Program Files (x86)\Cumulus\web\index.htm" weathermansworld.com/index.htm
put "C:\Program Files (x86)\Cumulus\web\today.htm" weathermansworld.com/today.htm
put "C:\Program Files (x86)\Cumulus\web\yesterday.htm" weathermansworld.com/yesterday.htm
put "C:\Program Files (x86)\Cumulus\web\record.htm" weathermansworld.com/record.htm
put "C:\Program Files (x86)\Cumulus\web\trends.htm" weathermansworld.com/trends.htm
put "C:\Program Files (x86)\Cumulus\web\gauges.htm" weathermansworld.com/gauges.htm
put "C:\Program Files (x86)\Cumulus\web\thismonth.htm" weathermansworld.com/thismonth.htm
put "C:\Program Files (x86)\Cumulus\web\thisyear.htm" weathermansworld.com/thisyear.htm
put "C:\Program Files (x86)\Cumulus\web\images\wind.png" weathermansworld.com/images/wind.png
put "C:\Program Files (x86)\Cumulus\web\images\rain.png" weathermansworld.com/images/rain.png
put "C:\Program Files (x86)\Cumulus\web\images\press.png" weathermansworld.com/images/press.png
put "C:\Program Files (x86)\Cumulus\web\images\temp.png" weathermansworld.com/images/temp.png
put "C:\Program Files (x86)\Cumulus\web\images\windd.png" weathermansworld.com/images/windd.png
put "C:\Program Files (x86)\Cumulus\web\images\raint.png" weathermansworld.com/images/raint.png
put "C:\Program Files (x86)\Cumulus\web\images\tempm.png" weathermansworld.com/images/tempm.png
put "C:\Program Files (x86)\Cumulus\web\images\raind.png" weathermansworld.com/images/raind.png
put "C:\Program Files (x86)\Cumulus\web\images\windsm.png" weathermansworld.com/images/windsm.png
put "C:\Program Files (x86)\Cumulus\web\images\rainsm.png" weathermansworld.com/images/rainsm.png
put "C:\Program Files (x86)\Cumulus\web\images\presssm.png" weathermansworld.com/images/presssm.png
put "C:\Program Files (x86)\Cumulus\web\images\tempsm.png" weathermansworld.com/images/tempsm.png
put "C:\Program Files (x86)\Cumulus\web\images\winddsm.png" weathermansworld.com/images/winddsm.png
put "C:\Program Files (x86)\Cumulus\web\images\raintsm.png" weathermansworld.com/images/raintsm.png
put "C:\Program Files (x86)\Cumulus\web\images\tempmsm.png" weathermansworld.com/images/tempmsm.png
put "C:\Program Files (x86)\Cumulus\web\images\raindsm.png" weathermansworld.com/images/raindsm.png
put "C:\Program Files (x86)\Cumulus\web\images\windrose.png" weathermansworld.com/images/windrose.png
put "C:\Program Files (x86)\Cumulus\web\images\windgauge.png" weathermansworld.com/images/windgauge.png
put "C:\Program Files (x86)\Cumulus\web\images\compass.png" weathermansworld.com/images/compass.png
put "C:\Program Files (x86)\Cumulus\web\images\moon.bmp" weathermansworld.com/images/moon.bmp
put "C:\Program Files (x86)\Cumulus\web\images\intemp.png" weathermansworld.com/images/intemp.png
put "C:\Program Files (x86)\Cumulus\web\images\hum.png" weathermansworld.com/images/hum.png
put "C:\Program Files (x86)\Cumulus\web\images\intempsm.png" weathermansworld.com/images/intempsm.png
put "C:\Program Files (x86)\Cumulus\web\images\humsm.png" weathermansworld.com/images/humsm.png
exit

Re: Secure FTP

Posted: Wed 27 Feb 2013 5:18 am
by BCJKiwi
2 things yet to try;
1. Anywhere in any Dos type command line you will need to enclose anything with spaces in it in quotes " ".
"c:\Program Files (x86)\Cumulus\sftp.bat"

winscp.com /script="c:\Program Files (x86)\Cumulus\script.txt" 2>&1 >"c:\Program Files (x86)\Cumulus\sftp-log.txt"
and in these lines you probably need a leading / for the destination.
put "C:\Program Files (x86)\Cumulus\realtime.txt" /weathermansworld.com/realtime.txt
If you look carefully when you are using wincsp manually it should show the path you are connected to (well I have not used an ftp program the doesn't but I have only used Filezilla for a long time now (I'm not suggesting you should change as the same issues will apply to whatever you use!).

Re: Secure FTP

Posted: Wed 27 Feb 2013 7:54 am
by steve
BCJKiwi wrote:Also Steve strongly recommends Cumulus is installed directly into C:\ not into "program files".
This would avoid all the issues around having to include the filespec in " "s and likely improve reliability. There are a number of issues using 'Dos' (i.e. batch file) techniques in Windows as some things just don't work as expected. So the simpler you can make the better.
Ah, well spotted, I completely missed where it was installed. This is likely to be causing a problem, as the files are probably not where they are expected to be, and there are likely to be problems with permissions.

Re: Secure FTP

Posted: Sat 02 Mar 2013 11:28 pm
by BCJKiwi
wxbear73;
How did you get on?

Re: Secure FTP

Posted: Sun 03 Mar 2013 2:35 am
by wxbear73
Still haven't figured out the problem. I am going to try and sit down and do each line manually tomorrow if I get the chance. I am not getting any error logs and I am not sure Cumulus is even trying to run the remote program at all.