Advertisements

#MikrotikTips Auto Backup Mikrotik and auto transfer upload to another mikrotik

Biasakan membaca sampai selesai, bijaklah dalam mengambil kesimpulan dari sebuah artikel. Beberapa artikel dibagi menjadi beberapa halaman. 
Silahkan Share dan beri respon saran kritik jika sobat meyukai artikel ini
Print Friendly, PDF & Email

Script Auto Backup Mikrotik and auto transfer upload to another mikrotik. Penting untuk di pakai sebagai admin jaringan

Informasi umum Auto Backup Mikrotik

  • 2 Unit, Mikrotik 5.20 (main and secondary as backup)
  • User manager installed

Flowchart Auto Backup Mikrotik

  1. Generate backup for UserManager temporary.
    2. log info message=UserManagerBackupFinished.
  2. Generate backup for system temporary.
  3. log info message=SystemBackupFinished.
  4. Upload the UserManagerDB Backup to FTP server.
  5. Upload the System Backup to External FTP server.
  6. remove Temporary back file UserManager + system.
  7. log info message=UserMangerBackup-SystemBackup-TempRemoved.
  8. log info message=UserManger-SystemBackup2CentOS-Finished “FTP server”

SCRIPT Auto Backup Mikrotik
#automated System - UM database backup 2 External FTP
#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]
:set ds ([:pick $ds 7 11].[:pick $ds 0 3].[:pick $ds 4 6])
#This line to generate the file name for user manager backup - file name will be UMDB- ServerName? - Date? - Time?
:local fname ("/UMDB-".[/system identity get name]."-".$ds."-".$ts.".umb")
#This line to generate the file name for System backup - file name will be UMDB- ServerName? - Date? - Time?
:local fname1 ("/UMDB-".[/system identity get name]."-".$ds."-".$ts.".backup")
#all above is workaround to get unique $filename=UserManagerDB  - $filename1=System
/tool user-manager database save name=$fname
:log info message=UserManagerBackupFinished;
/system backup save name=$fname1
:log info message=SystemBackupFinished;
#Upload the UserManagerDB Backup to External FTP - change address to your ftp server + user + pass
/tool fetch address=192.168.252.2 src-path=$fname user=bb password=bb mode=ftp port=21 dst-path=$fname upload=yes
#Upload the System Backup to External FTP - change address to your ftp server + user + pass
/tool fetch address=192.168.252.2 src-path=$fname1 user=bb password=bb mode=ftp  port=21 dst-path=$fname1 upload=yes
#Delay time to finish the upload - increase it if your backup file is big
:delay 60s;
#Find file name start with UMDB- then remove
:foreach i in=[/file find] do={:if ([:typeof [:find [/file get $i name] "UMDB-"]]!="nil") do={/file remove $i}}
:log info message=UserMangerBackup-SystemBackup-TempRemoved;
:log info message=UserManger-SystemBackup2CentOS-Finished;

Add schedule to run script everyday or whatever you need

Artikel Terkait   #MikrotikTips Menggunakan Mikrotik Bandwitdh Test

Note :

– Your secondary mikrotik should has ftp user, write access

– Replace address, user, password and port with your secondary mikrotik

Auto Backup Mikrotik. Auto Backup Mikrotik. Auto Backup Mikrotik.

Advertisements

us jauhari

Pernah mukim di salah satu Penjara Suci Bumi Reog. Traveller, Backpacker, Mountaineer dan coretan-coretan Phone : 08214435xxxx mcretive always opening your mind

You may also like...

2 Responses

  1. Fine way of explaining, and good post to obtain facts regarding my
    presentation subject, which i am going to convey in school.

Jangan lupa tinggalkan komentar ya gais

Sobat menyukai ini ?

Share aja ke akun sosmed kamu!