98. Mikrotik Backup and Export Configuration to Dropbox



You can contact me: plus.google.com/+PhallaCCMT; youtube.com/phallaccmt; facebook.com/Phalla.CCMT; twitter.com/PhallaCCMT and Phalla.CCMT@gmail.com

Script:
#SendToDropbix address
:local DropboxAddr "phalla_a430@sendtodropbox.com"

#GetDate
:local GDate [/system clock get date]
:local GDay [ :pick $GDate 4 6 ]
:local GMonth [ :pick $GDate 0 3 ]
:local GYear [ :pick $GDate 7 11 ]
:local GResult "$GDay $GMonth $GYear"

# file name for user manager backup
:local UserMan ([/system identity get name]."-".$GResult.".umb")
# file name for system backup
:local BackupConf ([/system identity get name]."-".$GResult.".backup")
# file name for config export
:local ExportConf ([/system identity get name]."-".$GResult.".rsc")

# backup the data
/tool user-manager database save name=$UserMan overwrite=yes
:log info message="User manager backup finished (1/3).";
/system backup save name=$BackupConf
:log info message="System backup finished (2/3).";
/export compact file=$ExportConf
:log info message="Config export finished (3/3)."

# Send the user manager backup
:log info message="Uploading user manager backup (1/3)."
/tool e-mail send to="$DropboxAddr" subject=([/system identity get name] . " Backup on $GResult") from=alertphalla@gmail.com file=$UserMan server=173.194.77.108

# Send the system backup
:log info message="Uploading system backup (2/3)."
/tool e-mail send to="$DropboxAddr" subject=([/system identity get name] . " Backup on $GResult") from=alertphalla@gmail.com file=$BackupConf server=173.194.77.108

# Send the config export
:log info message="Uploading config export (3/3)."
/tool e-mail send to="$DropboxAddr" subject=([/system identity get name] . " Backup on $GResult") from=alertphalla@gmail.com file=$ExportConf server=173.194.77.108

:delay 3s;
:log info message="Configuration backup to Dropbox finished.";



Note:
        - Gmail Server : 173.194.77.108
        - Gmail Port     :  587

Ref:  https://sendtodropbox.com
         https://www.dropbox.com/home/Apps/Attachments

Previous
Next Post »

1 comments:

Write comments
Haider Saeed
AUTHOR
August 5, 2017 at 8:03 AM delete

Hi, thanks for the wonderful theme. A possible way to delete the old automatic

Reply
avatar