MikroTik – Configuration backup and forward on Gmail Account.
In this new article, we’ll be able to send an e-mail Gmail, an automatic daily backup of our systems MikroTik.
n. 1 MikroTik RB951-2n;
The RouterBoard is updated with the firmware version 3.10 and with RouterOS 6.20.
1° Step – Add in System/Script a new script that will call backup_mail Fig. 1.
2° Step – Inside the Script window we copy the following script, remembering to replace the parameters in bold with the credentials of our e-mail Gmail Fig.2.
:log warning “Start Backup MikroTik Router . . . “
:global backupfile configbackup
:global mikrotikexport mtexport_backup
:global sub1 ([/system identity get name])
:global sub2 ([/system clock get time])
:global sub3 ([/system clock get date])
:global adminmail1 your_email@gmail.com
:global gmailid your_email@gmail.com
:global gmailpwd your_password
:global gmailip
:set gmailip [:resolve “smtp.gmail.com”];
:log warning “Creating a new backup file. . . “
/system backup save name=$backupfile
/export file=$mikrotikexport
:log warning “Pause backup process for 10 seconds so that it can complete the backup, if the system is busy …”
:delay 10s
:log info “Sending Files created via Email. . .”
/tool e-mail send to=$adminmail1 password=$gmailpwd subject=”$sub3 $sub2 $sub1 file backup” from=$gmailid file=$backupfile server=$gmailip start-tls=yes
/tool e-mail send to=$adminmail1 password=$gmailpwd subject=”$sub3 $sub2 $sub1 file rsc” from=$gmailid file=$mikrotikexport server=$gmailip start-tls=yes
:delay 10s
# Automatically delete old backups.
/file remove $backupfile
/file remove $mikrotikexport
:log warning “Backup completed successfully.”
:global backupfile configbackup
:global mikrotikexport mtexport_backup
:global sub1 ([/system identity get name])
:global sub2 ([/system clock get time])
:global sub3 ([/system clock get date])
:global adminmail1 your_email@gmail.com
:global gmailid your_email@gmail.com
:global gmailpwd your_password
:global gmailip
:set gmailip [:resolve “smtp.gmail.com”];
:log warning “Creating a new backup file. . . “
/system backup save name=$backupfile
/export file=$mikrotikexport
:log warning “Pause backup process for 10 seconds so that it can complete the backup, if the system is busy …”
:delay 10s
:log info “Sending Files created via Email. . .”
/tool e-mail send to=$adminmail1 password=$gmailpwd subject=”$sub3 $sub2 $sub1 file backup” from=$gmailid file=$backupfile server=$gmailip start-tls=yes
/tool e-mail send to=$adminmail1 password=$gmailpwd subject=”$sub3 $sub2 $sub1 file rsc” from=$gmailid file=$mikrotikexport server=$gmailip start-tls=yes
:delay 10s
# Automatically delete old backups.
/file remove $backupfile
/file remove $mikrotikexport
:log warning “Backup completed successfully.”
3° Step – Open the window Email Setting in Tools/Email, and insert the configuration parameters for the outgoing e-mail. The IP address 173.194.65.108 corresponds to the SMTP server smtp.gmail.com. through the Send Email button inserts verify whether the parameters are correct Fig. 3.
4° Step – We open the window Scheduler in System/Scheduler, and add a new event as represented in Fig. 4.
5° Step – Finally we insert a new rule in Logging, then we’re going to select System/Logging, click the add (+), and define a rule that will allow us to have a featured within our Log Fig. 5.
Here are the results as Fig. 6 – 7 – 8 !!! Thanks and see you next guide.
Comments
Post a Comment