Script on 6.41RC - fetch not working
Posted: Sat Oct 21, 2017 4:53 pm
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:
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:
Code: Select all
: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"