# # Created Jotne 2023 v1.6 # # 1.6 Fixed script for x86 devicews (Credit rextended) # 1.5 Fixed for router missing serial # 1.4 Added Router OS version # 1.3r Revised by rextended # 1.3 / 1.2 try to fix v6/v7 compability # 1.1 added "show-sensitive" # 1.0 initial release # # Takes two different backup and send then to email # # backup.rsc readable backup # Certificates, the Dude and Usermanager are also NOT exported or backed up fully and should be backed up separately # Can be used to restore config to different routers # # backup.bin binary backup # Binary backup that can only be used to fully restored the same router. # :local email "@gmail.com" :local rscfn "backup" :local bakfn "bin" /system :local date [clock get date] :local time [clock get time] :local info [identity get name] :local board ([resource get board-name]) :local files "$rscfn.rsc,$bakfn.backup" :local Version [resource get version] /system :local serial "undefined" :if (!($board~"(x86|CHR)")) do={ :global testrbsn "NO RouterBOARD" :execute ":global testrbsn; :set testrbsn [/system routerboard get serial-number]" :delay 1s :set serial $testrbsn :set testrbsn } else={ :if ($board="x86") do={:set serial [license get software-id]} :if ($board="CHR") do={:set serial [license get system-id]} } :if ($Version~"^7") do={ [:parse "/export show-sensitive file=$rscfn.rsc"] } else={ /export file="$rscfn.rsc" } :delay 2s /system backup save name="$bakfn" :delay 2s /tool e-mail send to="$email" subject="Mikrotik: Backup $info $Version $serial" file="$files" body="Automatic Backup of $info $serial at $date $time" :delay 20s :execute "/file remove $files" :log info "Backup router=$info serial=$serial ok"
PS Since gmail are free, I suggest you make a new email for your backup files.
----------------------------------------------------------------------------------------
UseSplunk>to log/monitor your雷竞技网站Router(s). See link below.
MikroTik->Splunk