User Tools

Site Tools


networking:router:mikrotik_backup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
networking:router:mikrotik_backup [2019/08/27 09:07]
gcooper
networking:router:mikrotik_backup [2022/11/22 14:25] (current)
gcooper
Line 12: Line 12:
  
 Export section by section and import one section at a time. Export section by section and import one section at a time.
 +
 +===== Automated Backup =====
 +
 +{{:networking:router:mikrotik_email_settings.png?direct&300 |E-Mail Settings}} {{:networking:router:mikrotik_makebackup_script.png?direct&500 |makebackup Script}}
 +
 +==== E-Mail Settings ====
 +
 +Sending e-mail is sensitive due to security.  If you have problems, be sure to send **from** a valid account.
 +
 +<file>
 +# Edit Mail Settings
 +:local emailserverip "ip.of.mail.server";
 +:local emailfrom "XYZ Router <valid@fromaddress.tld>";
 +:local emailto "you@yourdomain.tld";
 +:local emailusername "validusername";
 +:local emailpassword "validpassword";
 +
 +/tool e-mail set from="$emailfrom" address="$emailserverip"\
 +   port=587 tls=starttls user="$emailusername" password="$emailpassword";
 +</file>
 +
 +==== makebackup Script ====
 +
 +<file>
 +# Automatic backup script
 +:log info "Starting Backup Script";
 +:local SYSname [/system identity get name];
 +:put "Backing up $SYSname";
 +/system backup save name="$SYSname";
 +/export file="$SYSname";
 +:log info "Backup pausing for 10s";
 +:delay 10s;
 +:log info "Finished backing up configuration, sending e-mail";
 +:local files {($SYSname . ".backup");($SYSname . ".rsc")};
 +/tool e-mail send to="you@yourdomain.tld" tls=starttls subject=($SYSname . " backup") \
 +  body="See attached backup files." file=$files;
 +:log info "Backup pausing for 10s";
 +:delay 10s;
 +:log info "Removing backup file";
 +:put "Removing backup file";
 +/file remove ($SYSname . ".backup");
 +/file remove ($SYSname . ".rsc");
 +:log info "Finished Backup Script";
 +</file>
networking/router/mikrotik_backup.1566918454.txt.gz · Last modified: 2019/08/27 09:07 by gcooper