Giter Site home page Giter Site logo

bryanfranklyn / mikrotik-routeros-automatic-backup-and-update Goto Github PK

View Code? Open in Web Editor NEW

This project forked from beeyev/mikrotik-routeros-automatic-backup-and-update

0.0 1.0 0.0 117 KB

Script sends backups to email and keep your mikrotik firmware up to date.

License: MIT License

Rascal 100.00%

mikrotik-routeros-automatic-backup-and-update's Introduction

Mikrotik RouterOS automatic backup and update

This script provides an ability to create Mikrotik's daily backups to email. You can also enable automatic RouterOS upgrade or leave only notifications about new firmware versions.

Features:

  • Ability to choose script operating mode according to your needs. (Read below)
  • Script creates backups of the whole system and exported config.
  • You can set a preferred update channel.
  • If automatic updates are enabled, you can set script to install only patch versions of RouterOS updates. This means if the current RouterOS version is v6.43.6, the script will automatically install v6.43.7 (new patch version) but not v6.44.0 (new minor version), for example.
  • Script includes primary information about the device into the email message. So you can easily find the backup you need among multiple devices.
  • For safety purposes, an automatic update process will not be started if script could not send backups to email.
  • Routerboard firmware can be automatically upgraded according to the installed RouterOS version.

Script operating modes:

Backups only - script creates system and config backups and sends them to specified email as an attachment. Using email account as storage for your backups.
Backups and notifications about new RouterOS release - Except backups, script also checks for new RouterOS firmware release and provides this information in the email.
Backups and automatic RouterOS upgrade - Script makes a backup, then checks for new RouterOS version, and if new firmware released, script will initiate upgrade process. By the end, you receive two emails. The first one contains system backups of the previous RouterOS version, the second message will be sent when the upgrade process is done (including backups of the updated system).

How to use

1. Configure parameters

Take the script and configure it's parameters at the begining of the file.
This is not difficult because all parameters are well commented.
Imprtant! Don't forget to provide correct email address for backups and pay attention a scriptMode variable.

2. Create new script

System -> Scripts [Add]

Imprtant! Script name has to be BackupAndUpdate
Put the script which you configured earlier into the source area.

3. Configure mail server

Tools -> Email
Set your email server parameters. If you don't have one, i recommend to use smtp2go.com service, it allows sending a thousand emails per month for free.

To check email settings, send a test message by running the following command in terminal:

/tool e-mail send to="[email protected]" subject="backup & update test!" body="It works!";
4. Create scheduled task

System -> Scheduler [Add]
Name: Backup And Update
Start Time: 03:10:00
Interval: 1d 00:00:00
On Event: /system script run BackupAndUpdate;

Or you can use this command to create the task:

/system scheduler add name="Firmware Updater" on-event="/system script run BackupAndUpdate;" start-time=03:10:00 interval=1d comment="" disabled=no
5. Test the script

When everything is done, you need to make sure that the script is working correctly.
To do so, open a New Terminal and Log window in your WinBox, then run the script manually by executing this command /system script run BackupAndUpdate; in Terminal.
You will see the script working process in the log window. If the script finished without errors, check your email, there is a fresh message with backups from your MikroTik waiting for you ๐ŸŽ‰

License

The MIT License (MIT). Please see License File for more information.


mikrotik-routeros-automatic-backup-and-update's People

Contributors

beeyev avatar tebiev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.