Mikrotik - Automated configuration backup

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

First step

Define mail server:

/tool e-mail
set address=10.23.23.1 \
    [email protected] \
    user=email_user \
    password=email_password \
    port=25 \
    starttls=yes 

Second step

Create script to store and send configuration:

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

Third step

Execute 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 current run count and next run date execute similar command:

[[email protected]] /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

About Milosz Galazka

Milosz is a Linux Foundation Certified Engineer working for a successful Polish company as a system administrator and a long time supporter of Free Software Foundation and Debian operating system. He is also open for new opportunities and challenges.