Code: Select all
# Get the date in the format dd-mm-yyyy
:local tmpdate [/system clock get date];
:local months ("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");
:local month [ :pick $tmpdate 0 3 ];
:local mm ([ :find $months $month -1 ] + 1);
:if ($mm < 10) do={ :set mm ("0" . $mm); }
:local date ([:pick $tmpdate 4 6] ."-" . $mm ."-" . [:pick $tmpdate 7 11])
# Set params for FTP
:local myname "object_name"
:local fname ($myname."_".$date);
#:local bname ($myname."_".$date.".backup");
:local ename ($myname."_".$date.".rsc");
:local ftpuser "user";
:local ftppass "pwd";
:local ftpaddr "192.168.0.123";
# Backup settings
#/system backup save name=$fname dont=yes;
#:delay 10;
/export file=$fname
:delay 10;
# Upload files to FTP
#/tool fetch address=$ftpaddr src-path=$bname user=$ftpuser password=$ftppass port=21 upload=yes mode=ftp dst-path=$bname
#:delay 15;
/tool fetch address=$ftpaddr src-path=$ename user=$ftpuser password=$ftppass port=21 upload=yes mode=ftp dst-path=$ename
# Remove files from device
#/file remove $bname;
/file remove $ename;