M
M
MrDZ2019-04-02 14:29:15
Mikrotik
MrDZ, 2019-04-02 14:29:15

How to download a file via ftp from mikrotik?

dd. I want to collect data on micrometers, what firmware are. The script creates a file on Mikrotik with the format name ip-version.txt, but I can't download the file via FTP from Mikrotik.

{
:local sysname [/ip dhcp-server network get number=0 gateway];
:local sysversion [/system package update get installed-version];
:local file [system package update check-for-updates file=("$sysname-" . "$sysversion")]
:local ftphost "192.168.1.2";
:local ftpuser "User";
:local ftppassword "pass";
:local ftppath "/";
/tool fetch address="$ftphost" src-path="$file" user="$ftpuser" mode=ftp password="$ftppassword" dst-path="$ftppath/$file.txt" upload=yes
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MrDZ, 2019-11-18
@MrDZ

I will answer my own question

{
:local sysname [/ip dhcp-server network get number=0 gateway];
:local sysversion [/system routerboard get current-firmware];
:local file [system package update check-for-updates file=("$sysname-" . "$sysversion")]
:local files [("$sysname-" . "$sysversion")]
:delay 3s;

:local ftphost "192.168.1.2";
:local ftpuser "User";
:local ftppassword "password";
:local ftppath "/";

/tool fetch address="$ftphost" src-path="$files.txt" user="$ftpuser" mode=ftp password="$ftppassword" dst-path="$ftppath/$files.txt" upload=yes
}

D
Dmitry Alexandrov, 2019-04-02
@jamakasi666

Maybe it's better to immediately discard such crutches with the collective farm and use SNMP?
On the question, Is ftp enabled in services? Created a user with ftp rights? Finally, what is the error? Telepaths on vacation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question