Backup Konfigurasi Mikrotik dan Secara Otomatis Kirim ke Email


script yang nanti akan di eksekusi melalui scheduller yang akan kita tentukan waktunya, misalnya 1 kali dalam seminggu.

#----deklarasi variable------------------------------------------------
#:local ts [/system clock get time]
#:set ts ([:pick $ts 0 0].[: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 identitasRouter [/system identity get name];
:local emailTujuan [/tool e-mail get from];
:local seriMikrotik [/system resource get board-name];
#--------------------------------------
#-----Backup keseluruhan---------------
:local FileBackup ($identitasRouter.$seriMikrotik."-semua-".$ds.".backup")
/sys backup save name=$FileBackup;
#-----Mengirim email-------------------
:delay 30s
:log info "Sedang mengirim email, silahkan tunggu beberapa detik..."
/tool e-mail send subject=$FileBackup body=$FileBackup to=$emailTujuan tls=yes file=$FileBackup
:log info "Email sudah terkirim..."
#--------------------------------------
#-----menghapus -----------------------
:delay 120s
:if ([:len [/file find name=$FileBackup]] > 0) do={/file remove $FileBackup}
:log info "$FileBackup telah dihapus..!"

Masukan script diatas kedalam kolom script

Selanjutnya kita buat scheduler

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s