Page 1 of 1

Script on 6.41RC - fetch not working

Posted: Sat Oct 21, 2017 4:53 pm
by sutrus
Hello,
Sorry for my bad English.
I need an advice. My script is not working at 6.41RC on 6.40 OK.
Export to flash drive is OK but fetch to FTP is not working.
Mikrotik Log: ftp backup error: xxxxxxx

Log on my local FTP server. Address 192.168.1.1 login OK, but no write backup:
Image
:local hostname "RB962_Fug8";
:local ftpusername "name";
:local ftppassword "password";
:local ftpserverip "192.168.1.2";
:local ftpserverport "21";

:local time [/system clock get time];

# months array
:local months ("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");

# extract month from date
:local datemonth [ :pick [/system clock get date] 0 3 ];

# get position of our month in the array = month number
:local mm ([ :find $months $datemonth -1 ] + 1);

# if month number is less than 10 (a single digit), then add a leading 0
:if ($mm < 10) do={
   :set datemonth ("0" . $mm);
# otherwise, just set it as the number
} else={
   :set datemonth $mm;
}

#create date format  dd_mm_yyyy
:local date ([:pick [/system clock get date] 4 6]."_". datemonth ."_". [:pick [/system clock get date] 7 11]);

:local filename "$hostname-$date-$time";

:log warning "ftp backup start: disk1/$filename.rsc";
/export file="disk1/$filename";

:local backupfile ("BackupMikrotik/" . filename . ".rsc");
:do {
  /tool fetch mode=ftp address=$ftpserverip port=$ftpserverport user=$ftpusername password=$ftppassword src-path="disk1/$filename.rsc" dst-path=$backupfile upload=yes;
   :log info "ftp backup OK: $backupfile";
} on-error={
   :log error "ftp backup error: $backupfile";
}

:delay 2s;
#/file remove "$filename.rsc"

Re: Script on 6.41RC - fetch not working

Posted: Mon May 14, 2018 1:27 pm
by simogere
Any solution?

Re: Script on 6.41RC - fetch not working

Posted: Mon May 14, 2018 4:54 pm
by dasiu
Have you tried running the "/tool fetch" command manually? Does it work? If not - can you put the output here?

Re: Script on 6.41RC - fetch not working

Posted: Mon May 14, 2018 5:31 pm
by simogere
Have you tried running the "/tool fetch" command manually? Does it work? If not - can you put the output here?
It doesn't work manually too.

With filezilla it works.
status: failed

failure: connection timeout

Re: Script on 6.41RC - fetch not working

Posted: Wed Jan 30, 2019 3:55 pm
by VincentL
Hello,

Same problem here with 6.43.8. FTP server is "The Dude"
It works with fileZilla and WinSCP (ftp mode), but tool fetch doesn't works. It give to me "status: failed" ans "failure: connection timeout"
This is my command : /tool fetch address=x.x.x.x src-path=myscript.auto.rsc user=ftpuser mode=ftp password=ftppassword dst-path=myscript.auto.rsc port=21 keep-result=yes

Vincent

Re: Script on 6.41RC - fetch not working

Posted: Mon Feb 04, 2019 3:56 pm
by VincentL
Hello,
I found what's going wrong for me : Mikrotik tried to fetch script through public network gateway to resolve a private IP for the server which is on another site and connected with a VPN.
I opened a TFTP with a public IP.

Vincent