AVA Studio ID

lisensi

Iklan

AVA Studio
30 December 2022, 10:45 WITA (GMT+8)
Last Updated 2022-12-30T06:45:51Z

Script MikroTik RouterOS || Auto Backup Filename.backup and Send To Gmail

Advertisement
MikroTik Script RouterOS || Auto Backup Filename.backup and Send To Gmail

In Mikrotik routers, it is possible to set up an automatic backup system that creates a backup file of the router's configuration and sends it to a specified email address, such as a Gmail address. To do this, you will need to use the Mikrotik RouterOS command-line interface (CLI) or the Mikrotik RouterOS web-based configuration interface to set up a schedule for the backups, specify the email address to which the backups should be sent, and configure any other relevant settings.

Here is an example of how you might set up an automatic backup system in a Mikrotik router that creates a backup file with a filename of "filename.backup" and sends it to a Gmail address:
  1. Open the Mikrotik RouterOS CLI or web-based configuration interface.
  2. Set up a schedule for the backups. This can be done using the "/system scheduler" command, followed by the appropriate parameters to specify the frequency and timing of the backups.
  3. Specify the email address to which the backups should be sent. This can be done using the "/tool email" command, followed by the appropriate parameters to specify the email address and any other relevant settings.
  4. Create a script to perform the backup and send it to the specified email address. This can be done using the "/system script" command, followed by the appropriate parameters to specify the script name, the backup filename, and any other relevant settings.
  5. Add the script to the scheduler using the "/system scheduler add" command, followed by the appropriate parameters to specify the script name and the schedule you created in step 2.
Once these steps have been completed, the Mikrotik router will automatically create a backup of its configuration with a filename of "filename.backup" and send it to the specified Gmail address according to the schedule you specified.

How to Automatically Backup Filename.backup and Send to Gmail
Setup Your email first on Tool > Email

/tool e-mail set address=74.125.200.109 from=xxx@gmail.com password=xxxx port=587 start-tls=yes user=xyz@gmail.com

You can Input this scripts to Scheduler and you can set backup to gmail every weeks use interval like "7d 00:00:00"


#************************************************************
# BACKUP FILENAME.BACKUP AND SEND TO GMAIL BY AVA Studio ID
#************************************************************
:global backupfile ([/system identity get name] . "-" . [/system clock get time])
/system backup save name=$backupfile
:delay 30s
:log info "backup being emailed"
/tool e-mail send to="xxxx@gmail.com" subject=([/system identity get name] . " - ". [/system clock get time] . " - " . [/system clock get date] . "") from=xyz@gmail.com file=("$backupfile" . ".backup")
:delay 30s
/file remove ("$backupfile" . ".backup")

No comments:

Post a Comment

Selamat Datang

X
X