Page 1 of 1

External programs

Posted: Sun 05 Jan 2020 3:38 pm
by laulau
Hi,
I recently upgrade to Cumulus MX 3.2.5 buil3061 and it seem sthat my dayly external program not run as before.
it's a "batch file (.cmd) that calls a ftp command. if i run it manually it does what expected but it fails at rollower !
Could someone help me about this ?
Thanks

Re: External programs

Posted: Mon 06 Jan 2020 5:18 am
by Phil23
Just checked mine since I'm also now on 3062 & it's still working fine.

It's just a file called DayEnd.bat

Code: Select all

@echo off
echo Waiting a few seconds for End of Day to complete.

ping localhost -n 5 > nul

copy "\\WEATHER-PC\Cumulus\data\dayfile.txt" + "\\WEATHER-PC\CumulusMX\data\dayfile.txt" "\\WEATHER-PC\CumulusMX\Scripts\dayfile-merged.txt" /b /y

cd \cumulusmx
Rem cumulusutils Top10 pwsFWI SysInfo Graphs MapsOn
cumulusutils Top10 pwsFWI SysInfo Graphs

"C:\CumulusMX\scripts\fnr.exe" --cl --dir "C:\CumulusMX\utils" --fileMask "graphs.txt" --find "'Normal', color: 'black'," --replace "'Normal', color: 'lightgray', lineWidth: 12,"
"C:\CumulusMX\scripts\fnr.exe" --cl --dir "C:\CumulusMX\utils" --fileMask "graphs.txt" --find "'Normal',  color: 'black'," --replace "'Normal', color: 'lightgray', lineWidth: 12,"

ftp -s:"\\WEATHER-PC\CumulusMX\Scripts\ftp.txt"

Ping localhost -n 5 > nul
CD\

Not sure how lone I was on 3061, but may have missed the issue if it was present.

Cheers.

Re: External programs

Posted: Mon 06 Jan 2020 3:23 pm
by mcrossley
There have been no (intended!) changes the external program processing since Steve's last build 3043.

Re: External programs

Posted: Tue 07 Jan 2020 8:27 am
by laulau
My batch file runs well from the command line but hangs when initiated from CMX external program!
It's the ftp command , the connection is ok but the 'D:\CumulusMX\data\testfile.txt ' hangs !

Re: External programs

Posted: Tue 07 Jan 2020 10:01 am
by mcrossley
Perhaps if you post the batch file we can take a look and make suggestions?

Re: External programs

Posted: Tue 07 Jan 2020 7:33 pm
by Phil23
Just while on external programs, it's unclear when they are precisely run.

Are they executed after all internal processes are completed & all files for the interval updated & closed, or could they be triggered such that the timing of other process overlap if the internal processes & file writes have not completed, particularly on slower machine or big data sets.

I vaguely recall some initial issues with creating my script above, where it bombed as if the dayfile was in use.

As you can see I added some pings for a delay at the beginning & it work fine after that & ever since.

Phil

Re: External programs

Posted: Tue 07 Jan 2020 8:02 pm
by laulau
The batch file colled at rollower(uploadDF.cmd):

Code: Select all

ftp -s:D:\CumulusMX\dayfileftp.txt
call D:\CumulusMX\savec.bat
"C:\Program Files (x86)\GnuWin32\bin\wget" "http://....
dayfileftp.txt:

Code: Select all

open ftp.laurentmey.fr
login******
passw***
cd /www//meteo
put D:\CumulusMX\data\dayfile.txt
cd /www//domo
put P:\DomoData\domodayfile.txt
quit
savec.bat:

Code: Select all

@echo off
set source=D:\CumulusMX\data
set dest=P:\Meteo\CumulusMX\data

set mois=01
set an=20
echo copy %mois%%an%.txt
if %mois%==01 copy "%source%\janv%an%log.txt" "%dest%"
if %mois%==02 copy "%source%\f?vr%an%log.txt" "%dest%"
if %mois%==03 copy "%source%\mars%an%log.txt" "%dest%"
if %mois%==04 copy "%source%\avr%an%log.txt" "%dest%"
if %mois%==05 copy "%source%\mai%an%log.txt" "%dest%"
if %mois%==06 copy "%source%\juin%an%log.txt" "%dest%"
if %mois%==07 copy "%source%\juil%an%log.txt" "%dest%"
if %mois%==08 copy "%source%\ao?t%an%log.txt" "%dest%"
if %mois%==09 copy "%source%\sept%an%log.txt" "%dest%"
if %mois%==10 copy "%source%\oct%an%log.txt" "%dest%"
if %mois%==11 copy "%source%\nov%an%log.txt" "%dest%"
if %mois%==12 copy "%source%\d?c%an%log.txt" "%dest%"
copy "%source%\dayfile.txt" "%dest%"
copy "%source%\*.ini" "%dest%"
('mois' and 'an' variables are updated in CMX extra webfile)

I didn't make any change since a while but for the moment the ftp command hangs at rollower!

Re: External programs

Posted: Tue 07 Jan 2020 8:58 pm
by mcrossley
Does the "ftp" command require administrator rights?
ftp.exe is on the cmd path?

Otherwise I'm not sure, have you checked in the process list that the FTP command is actually running?

Also try adding a simple command before the FTP, just to make sure the batch file is running. Say something like...

Code: Select all

@echo %date% %time% Batch started > D:\CumulusMX\DailyBatchLog.txt
Any reason you aren't just using the CMX extra files facility to do these transfers and copies?
Then you'd just have to do the "wget" in the external program script.

Re: External programs

Posted: Tue 07 Jan 2020 10:16 pm
by laulau
I'm not sure that external program runs AFTER the CMX extra files facility !?

The point where it hangs:
Capture.JPG
The connection is ok but the ftp put timed out !

Re: External programs

Posted: Tue 07 Jan 2020 10:59 pm
by mcrossley
OK, the problem is on the line with response code 425
"Could not open data connection to port 56299"

Your FTP program is opening the control connection to port 21 on the remote host, but the data connection to the dynamic port (56299 in this case) is failing. So you can send commands and get responses but you cannot transfer any data.

No idea why.

Re: External programs

Posted: Tue 07 Jan 2020 11:04 pm
by mcrossley
The Extra files are processed at the end of the EOD process (after external programs) and are uploaded at the next archive interval after the EOD process completes.

Re: External programs

Posted: Tue 07 Jan 2020 11:25 pm
by laulau
That's why i first upload my dayfile and then use php script to update the remote database.
BTW how do you proceed ?

The strange thing is that it works when i manually execute the batch file.

Re: External programs

Posted: Wed 08 Jan 2020 12:02 am
by mcrossley
Sounds like a permissions thing to me - or firewall.