Categories
Uncategorized

Automated Mikrotik configuration backup

This is just a short note, more information can be found directly at the MikroTik Wiki – Automated Backups.

First step

Define the mail server.

/tool e-mail
set address=10.23.23.1 \
    from=email@address \
    user=email_user \
    password=email_password \
    port=25 \
    starttls=yes

Second step

Create a script to store and send configuration.

/system script add name="email-backup" source={
/export file=backup.rsc;
/tool e-mail send to="destination_email@address" \
      subject=([/system identity get name]." backup") \
      file=backup.rsc;
:log info "Backup email sent.";  }

Third step

Execute this script every four weeks.

/system scheduler
add disabled=no interval=4w name=email-backup-schedule
    on-event="/system script run email-backup"
    start-date=jun/08/2012 start-time=9:50:00

To check the current run count and next run date, execute the following command.

[admin@mt] /system scheduler> print detail
Flags: X - disabled
 0   name="email-backup-schedule"
     start-date=jun/08/2012 start-time=09:50:00 interval=4w
     on-event=/system script run email-backup owner="admin"
     run-count=1 next-run=jul/06 09:50:00