I would like to make a script to execute a cloud backup
The idea is, if the hardware die, I will need to download the backup to another router (Same hardware)
Have seen he following script: https://git.eworm.de/cgit/routeros-scripts/about/doc/backup-cloud.md
I did not find where to change the “to” email address to receive the backup results
I need this email because I will need the “secret-download-key” to download the backup in the other hardware.
Any idea or suggestion will be appreciated!
Thanks in advance.
Regards,
Damián
One is RB1100Dx4 and the other is RB1100Dx4 Dude Edition.
I recently did a backup and I could restore this in the another manually, I had no problem
Just thinking to have a current backup if some day the first Mikrotik die
I recently did a backup and I could restore this in the another manually, I had no problem
I never said it can’t be done..
Read the first paragraph here https://wiki.mikrotik.com/wiki/Manual:System/Backup System’s backup file also contain the device’s MAC addresses, which are also restored when the backup file is loaded.
So when you restore a .backup to another device you clone the MAC addresses too…
Anyways, if you prefer restoring a .backup rather than a .rsc its certainly you choice…
Zacharias, thanks for your answer
The last time, I reverted the MACs to the originals, so both will work for me.
I just need a way to keep all the configuration updated outside the hardware without depending on humans
If the best option is to do this cloud-backup, I will need the “secret-download-key” if I need to restore the configuration any time.
Any idea?
You can send a .backup file or .rsc through Emails too…
e.g. using a script you can create those backup files and then from the MikroTik send them to an email account of yours automatically…
I have now the following issue, if I execute the script from the terminal, it does work fine, I get the email correctly but when I schedulle to run the script automatically, I see in the logs the initial log write but nothing else, and I dont get the email.
Any suggestion?
Sorry, I though maybe someone had the same problem
I didnt think the issue was with the script because it does run correctly without the schedulled task (running from terminal)
Here the script:
/system script
add dont-require-permissions=no name=BackupToEmail owner=soporte policy=ftp,read,policy,test,sensitive source=":log info \"Iniciando backup semanal\";\r\
\n/system backup save name=Router_Bck_Weekly\r\
\n/system package print file Router_Version.txt\r\
\n:delay 00:00:01\r\
\n/ export file Router_Export_Weekly\r\
\n:delay 00:00:10\r\
\n/tool e-mail send file=Router_Bck_Weekly,Router_Export_Weekly.rsc,Router_Version.txt to=\"example@gmail.com\" body=\"Se adjuntan backup y export actua\
l al \$[/system clock get date].\" \\\r\
\n subject=\"Router - Backup y export \$[/system clock get date] a las \$[/system clock get time]\"\r\
\n:log info \"Backup semanal completado\""
For example, without reading all:
Without password permission, how the script can make backup? (backup containing also passwords)
Without write permission, how can save the file? (sended later on email)
“Router_Bck_Weekly” do not exist, is created “Router_Bck_Weekly.backup”
For example, without reading all:
Without password permission, how the script can make backup? (backup containing also passwords)
Without write permission, how can save the file? (sended later on email)
I just added the password permission and write permission to the script, still the same
Also, the script was working from Terminal as I said
“Router_Bck_Weekly” do not exist, is created “Router_Bck_Weekly.backup”
I dont know why but when I added the “.backup” to the file name, I got to my email account another file called “backup.backup”, without the “.backup” I get the 3 files correctly
I have a script on all my MT routers that does an export, a backup, and the version, and sends it via E-Mail. That scrip is scheduled every night. Obviously you have to have the E-Mail command already set up.
/system script
add dont-require-permissions=no name="Daily Backup" owner=Administrator policy=\
ftp,read,write,policy,test,password,sensitive source="# Policies needed: \
ftp, read, policy, sensitive, test, write\r\
\n# Policies NOT needed: password, reboot, sniff, romon\r\
\n:log info \"Starting daily backup\";\r\
\n/system backup save name=RB750r2-3_Daily\r\
\n/export file=RB750r2-3_Daily\r\
\n/system package print file=RB750r2-3_Version.txt\r\
\n:delay 00:00:01\r\
\n/tool e-mail send file=RB750r2-3_Daily.backup to=\"me@my.domain\" body=\
\"RasPi switch RB750r2-3 Router daily backup file attached.\" \\\r\
\n subject=\"RB750r2-3 \$[/system clock get date] at \$[/system clock g\
et time] Backup\"\r\
\n:delay 00:00:10\r\
\n/tool e-mail send file=RB750r2-3_Daily.rsc,RB750r2-3_Version.txt to=\
me@my.domain\" body=\"RasPi switch Router RB750r2-3 daily script and versio\
n files attached.\" \\\r\
\n subject=\"RB750r2-3 \$[/system clock get date] at \$[/system clock g\
et time] Script\"\r\
\n:log info \"Daily backup script completed\"\r\
\n"
I got this from this forum years ago and modified for my purposes.
I have no doubt that it could be better. I am EXTREMELY weak on MT scripting, so modified it only enough to make it work for my purposes.
I’ll take a look at the article you linked.