search tags # rextended export full backup complete user manager dude
notice for future versions: thanks k6ccc for the hint to save also the list of packages installed and if are active or not
I think I may have found the root cause after a series of netinstalls and slow re-adding my configuration.
I believe RouterOS 7 isn't compatible with this script
https://github.com/beeyev/Mikrotik-Rout ... Update.rsc, I haven't worked out if it's the script or RouterOS 7, but I am pretty sure this was the culprit.
I think from now on I am going to netinstall any new OS updates and re-apply my configuration script.
@kiler129 do you have the same script installed on yours or any other scripts for that matter?
395 lines to do.. nothing?
I do not want waste my brain to try to understand all...
I just give you this, just set correctly your parameters on /tools Email:
on v7 after each "export" add "show-sensitive" !!!
:local sendto "address@mail.ext"
:local certpass "myprivatepass"
/system clock
:local date [get date]
:local time [get time]
:local dsubj ""
:local dfile ""
:local bymail do={/delay 20s;/tool e-mail send to=$1 subject=$2 body=$2 file=$3}
/certificate
:foreach cert in=[find] do={
:local certname [get $cert name]
export-certificate $cert file-name="auto_$certname" type=pkcs12 export-passphrase=$certpass
:set dsubj "Backup Certificate $certname $date $time"
:set dfile "auto_$certname.p12"
$bymail $sendto $dsubj $dfile
}
/ip ssh export-host-key key-file-prefix=auto_host-key
:set dsubj "Backup Host Key $date $time"
:set dfile "auto_host-key_dsa,auto_host-key_dsa.pub,auto_host-key_rsa,auto_host-key_rsa.pub"
$bymail $sendto $dsubj $dfile
/system license output
:set dsubj "Backup Licence Key $date $time"
:set dfile "$[/system license get software-id].key"
$bymail $sendto $dsubj $dfile
/export file="auto_export"
:set dsubj "Backup Export $date $time"
:set dfile "auto_export.rsc"
$bymail $sendto $dsubj $dfile
/user export file="auto_user_export"
:set dsubj "Backup Export User $date $time"
:set dfile "auto_user_export.rsc"
$bymail $sendto $dsubj $dfile
/system backup save name="auto_backup" dont-encrypt=yes
:set dsubj "Backup Binary $date $time"
:set dfile "auto_backup.backup"
$bymail $sendto $dsubj $dfile
If you use user-manager (v6) add also:
/file remove [find where name="auto_user-manager.umb"]
/tool user-manager database save name="auto_user-manager"
:set dsubj "Backup User-Manager Database $date $time"
:set dfile "auto_user-manager.umb"
$bymail $sendto $dsubj $dfile
If you use user-manager (v7) add also:
/file remove [find where name="auto_user-manager.umb"]
/user-manager database save name="auto_user-manager"
:set dsubj "Backup User-Manager Database $date $time"
:set dfile "auto_user-manager.umb"
$bymail $sendto $dsubj $dfile
If you use The Dude add also:
/file remove [find where name="auto_thedude.db"]
/dude export-db backup-file="auto_thedude.db"
:set dsubj "Backup The Dude Database $date $time"
:set dfile "auto_thedude.db"
$bymail $sendto $dsubj $dfile
and if you want backup also all internal files, add at the bottom:
:local filelist ""
/file
:foreach file in=[find where type!=disk && type!=directory && !(name~"dude/files/default") && !(name~"^auto_") && !(name~"dude.db\$") && !(name~"db-...\$") && !(name~"user-manager")] do={
:if ($filelist != "") do={:set filelist ($filelist.",")}
:set filelist ($filelist.[get $file name])
}
:set dsubj "Backup all files inside $date $time"
:set dfile $filelist
$bymail
Thanks Amm0 for the "$" & "( )" fix
viewtopic.php?p=915848#p915822