How to configure automated backups on MikroTik save on Gmail | MikroTik Series

Ensuring you have regular backups of your MikroTik configuration is crucial. This method uses a RouterOS script and the Scheduler to automate the process and email the configuration file to your Gmail account daily.

Step 1: Create the Backup Script 

You will create a scheduled task that executes a script to first generate a configuration backup file (.rsc) and then email it.

  1. Navigate to System > Scheduler.

  2. Click the + button to create a new entry.

  3. Set the Name (e.g., Daily-Gmail-Backup).

  4. Configure the scheduling:

    • Start Date: Select today’s date.

    • Start Time: Choose a time when the network is idle (e.g., 04:00:00).

    • Interval: Set to 1d 00:00:00 (runs every day).

Tip: If you encounter errors, the video suggests disabling Less secure app access in your Google account security settings (or using an App Password if 2-Factor Authentication is enabled).

Paste the Script

In the On Event field, paste the script below, and update the required details (your email address, and the App Password):Code snippet

Step 2: Verify and Test the Backup 

After creating the schedule, you can manually trigger it to ensure it runs correctly and sends the email.

  1. Click Apply and OK on the scheduler dialog.

  2. If you wait for the scheduled time, the Run Count will increment, indicating it has run. 

  3. Check your Gmail inbox. You should receive an email with the subject line formatted like: “[Router Name] Configuration Backup.”

The email will contain the .rsc file as an attachment.

Leave a Reply

Your email address will not be published. Required fields are marked *