image1

LET'S MAKE SOMETHING|I'M MAKER FROM SANTRI

Cara Backup Mikrotik lewat FTP




Buat Scheduler backupnya.
Pertama script akan membuat 3 file backup (Konfigurasi, Srcipt, UserManagent) dengan nama file nama router os identity dan tanggal permbuatan backup YYYY-MM-DD.  Kemudian per file akan di upload satu persatu.
 

Catatan: FTP host user dan password dan dir nya haruslah tepat. Karena jika salah file tidak akan terkirim !

RouterOS Script

:local saveUserDB true :local saveSysBackup true :local encryptSysBackup false :local saveRawExport true :local FTPServer "*****" :local FTPPort 21 :local FTPUser "******" :local FTPPass "******"
:local FTPLocal "*****" :local ts [/system clock get time] :set ts ([:pick $ts 0 2].[:pick $ts 3 5].[:pick $ts 6 8]) :local ds [/system clock get date] :set ds ([:pick $ds 7 11].[:pick $ds 0 3].[:pick $ds 4 6]) :local fname ("BACKUP-".[/system identity get name]."-".$ds."-".$ts) :local sfname ("/".$fname) :if ($saveSysBackup) do={ :if ($encryptSysBackup = true) do={ /system backup save name=($sfname.".backup") } :if ($encryptSysBackup = false) do={ /system backup save dont-encrypt=yes name=($sfname.".backup") } :log info message="System Backup Finished" } if ($saveRawExport) do={ /export file=($sfname.".rsc") :log info message="Raw configuration script export Finished" } :local backupFileName "" :local ftppath .$flocal :foreach backupFile in=[/file find] do={ :set backupFileName ("/".[/file get $backupFile name]) :if ([:typeof [:find $backupFileName $sfname]] != "nil") do={ /tool fetch address=$FTPServer port=$FTPPort src-path=$backupFileName user=$FTPUser mode=ftp password=$FTPPass dst-path=$backupFileName upload=yes } } :delay 5s :foreach backupFile in=[/file find] do={ :if ([:typeof [:find [/file get $backupFile name] "BACKUP-"]]!="nil") do={ /file remove $backupFile } } :log info message="Successfully removed Temporary Backup Files" :log info message="Automatic Backup Completed Successfully"

Share this:

CONVERSATION

0 comments: