Tady posílám celý skript, včetně Uploadu na FTP
# ftp configuration
:local ftphost "123.456.123.456"
:local ftpuser "ftp"
:local ftppassword "123456"
:local ftppath "/disk1/Export_RB"
:local interface "ether1"
# months array
:local months ("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");
# get time
:local ts [/system clock get time]
:set ts ([:pick $ts 0 2].[:pick $ts 3 5].[:pick $ts 6 8])
# get Date
:local ds [/system clock get date]
# convert name of month to number
:local month [ :pick $ds 0 3 ];
:local mm ([ :find $months $month -1 ] + 1);
:if ($mm < 10) do={ :set mm ("0" . $mm); }
# set $ds to format YYYY-MM-DD
:set ds ([:pick $ds 7 11] . $mm . [:pick $ds 4 6])
#get IP
:local ip [/ip address get [find interface="$interface"] address];
:set ip [:pick $ip 0 [:find $ip "/"]]
# file name for config export
:local fname ("".$ip." - ".[/system identity get name]." - ".$ds." - ".$ts." - export.rsc")
# backup the data
/export compact file=$fname
# upload the config export
/tool fetch address="$ftphost" src-path=$fname user="$ftpuser" mode=ftp password="$ftppassword" dst-path="$ftppath/$fname" upload=yes
# delay time to finish the upload - increase it if your backup file is big
:delay 5s;
# find file name start with "export" then remove
:foreach i in=[/file find] do={ :if ([:typeof [:find [/file get $i name] "export"]]!="nil") do={/file remove $i}; }
:log info message="Configuration backup finished.";