Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
Удаленная работа для IT-специалистов
{ :local date ([:pick [/system clock get date] 4 6] . [:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 7 11]); :local backupfile ([/system identity get name] . "-" . $date); #ftp account :local ftphost "10.12.149.2"; :local ftpuser "ftpaccess"; :local ftppassword "secretpassword"; :local ftppath "/confbackup/mikrotik"; #create full system backup files /system backup save name="$backupfile.backup"; :delay 10s; #create config export files /export file="$backupfile.rsc"; :delay 10s; # upload the system backup :log info message="Uploading system backup" /tool fetch address="$ftphost" src-path="$backupfile.backup" user="$ftpuser" mode=ftp password="$ftppassword" dst-path="$ftppath/$backupfile.backup" upload=yes :delay 30s; # upload the config export :log info message="Uploading config export" /tool fetch address="$ftphost" src-path="$backupfile.rsc" user="$ftpuser" mode=ftp password="$ftppassword" dst-path="$ftppath/$backupfile.rsc" upload=yes :delay 30s; # find file name $backupfile- then remove /file remove [find name~".backup"]; /file remove [find name~".rsc"]; #:foreach i in=[/file find] do={ :if ([:typeof [:find [/file get $i name] "$backupfile"]]!="nil") do={/file remove $i}; } :log info message="Configuration backup finished"; }