Page 1 of 1
scp instead of ftp
Posted: Sat 12 Mar 2016 7:42 am
by tumutbound
Due to circumstances beyond my control, I can no longer ftp from CumulusMX to my Internet website. Network congestion is causing all ftp connection attempts to timeout
I can however use ssh/scp to copy the necessary files.
I can call a script from CumulusMX to do the ssh/scp copy but if I don't have ftp enabled in CumulusMX, the various web files do not get updated form the templates (true?)
Is there a way to have the various .htm files and .json files etc. updated without having ftp enabled?
This problem is likely to exist until the end of May so I don't mind putting in some effort to fix this.
Regards
Geoff
Re: scp instead of ftp
Posted: Sat 12 Mar 2016 10:47 am
by steve
MX processes templates and creates the json files without requiring ftp to be configured. To disable ftp, just set it up as normal but don't supply an ftp host.
Re: scp instead of ftp
Posted: Sat 12 Mar 2016 11:26 am
by tumutbound
Thanks Steve,
I did try deleting all of the ftp info but got an error message. Just tried with the host blank and it isn't complaining.
Another question on the same/related subject. I need to run a script to perform the scp. I've entered the name of this script into the External Program section under Internet Settings but it's either not being run or isn't doing the job. If I run the script as root, it works fine. I've tried this using just the script file-name and also with a full pathname.
Is the script run before or after the ftp transfer/file processing takes place?
Regards
GEoff
Re: scp instead of ftp
Posted: Sat 12 Mar 2016 11:31 am
by steve
If you turn on debug logging, the diags file will contain a message if/when it starts the command (one message before and one after starting), and any error will be logged (even without debug logging). Sometimes the command can fail in such a way that MX doesn't get told, though.
The command is executed after file processing and before FTP.
Re: scp instead of ftp
Posted: Sat 12 Mar 2016 12:26 pm
by tumutbound
Logging is on, ftp host is set to null and the files are correctly processed.
The log tells me that the external program has been run but it doesn't appear to be.
Code: Select all
2016-03-12 23:20:02.870 Executing program /home/weather/CumulusMX/weather_copy.sh testing
2016-03-12 23:20:02.887 External program started
The program is as basic as I can make it, list is a file with the names of the files to transfer. Program parameters is set to 'testing'
Code: Select all
scp -P 2783 `cat list` user@port-huon.com.au:~/hub/weather
echo $1 >>/tmp/logg
Running the script as either the weather user or root works as expected.
Any other debugging I can try?
Re: scp instead of ftp
Posted: Sat 12 Mar 2016 12:35 pm
by mcrossley
Try your echo as the first line of the script. I have MX running a shell script, daily rather than at update, but it works fine...
Untitled-1.jpg
Re: scp instead of ftp
Posted: Sat 12 Mar 2016 12:42 pm
by tumutbound
Thanks Mark, I'll make that change and see what happens.
EDIT: No change, still no output from program. FWIW, I'm running CumulusMX 3036
Regards
GEoff
Re: scp instead of ftp
Posted: Sat 12 Mar 2016 1:11 pm
by tumutbound
Doh!
I can't believe it, I forgot to put the magic #!/bin/sh as the first line of the shell script!
Script now works as expected and data is being uploaded to my web pages.