Kindis could you share your email backup script please?
Yes here they are. I have switched from E-mail backups to FTP. So now all routers upload to a FTP server that then send the backup offsite. The reason is that the ISP I have thinks the backup generated e-mail where a sign that my SMTP account had been hacked and changed the password all the time. Here are both script.
I which I could say that I'm smart enough to take credit for these but I'm not
I found the e-mail script on this forum and would credit the author if I remembered the name. FTP is just a slight rewrite which I did manage myself.
Email-Backup
:log info "Automated Backup Protocol Started"
:delay 2s
;log info "Creating Backup Files. This may take several minutes."
:local sysname [/system identity get name]
:local textfilename
:local backupfilename
:local time [/system clock get time]
:local date [/system clock get date]
:local newdate "";
:for i from=0 to=([:len $date]-1) do={ :local tmp [:pick $date $i];
:if ($tmp !="/") do={ :set newdate "$newdate$tmp" }
:if ($tmp ="/") do={}
}
:if ([:find $sysname " "] !=0) do={
:local name $sysname;
:local newname "";
:for i from=0 to=([:len $name]-1) do={ :local tmp [:pick $name $i];
:if ($tmp !=" ") do={ :set newname "$newname$tmp" }
:if ($tmp =" ") do={ :set newname "$newname_" }
}
:set sysname $newname;
}
:set textfilename ($"newdate" . "-" . $"sysname" . ".rsc")
:set backupfilename ($"newdate" . "-" . $"sysname" . ".backup")
:execute [/export file=$"textfilename"]
:execute [/system backup save encryption=aes-sha256 password=Backup_Encryption_Passsword name=$"backupfilename"]
:delay 5s
:log info "Sending Export File"
/tool e-mail send to="To_E-mail_Address" subject=([/system identity get name] . \
"_Automated_Backup") from="From_E-mail_Address" file=($"newdate" . "-" . $"sysname" . ".rsc") \
server=[:resolve "SMTP_Server_FQDN"] start-tls=yes port=587 \
password=password user=username
:delay 5s
:log info "Sending Backup File"
/tool e-mail send to="To_E-mail_Address" subject=([/system identity get name] . \
"_Automated_Backup") from="From_E-mail_Address" file=($"newdate" . "-" . $"sysname" . ".backup") \
server=[:resolve "SMTP_Server_FQDN"] start-tls=yes port=587 \
password=password user=username
:delay 5s
:log info "Sending Completed"
:delay 5s
:log info "Removing Backup files from router file list"
/file remove ($"newdate" . "-" . $"sysname" . ".rsc")
/file remove ($"newdate" . "-" . $"sysname" . ".backup")
:log info "Automated Backup Protocol Completed"
FTP Backup
:log info "Automated Backup Protocol Started"
:delay 2s
;log info "Creating Backup Files. This may take several minutes."
:local sysname [/system identity get name]
:local textfilename
:local backupfilename
:local time [/system clock get time]
:local date [/system clock get date]
:local newdate "";
:for i from=0 to=([:len $date]-1) do={ :local tmp [:pick $date $i];
:if ($tmp !="/") do={ :set newdate "$newdate$tmp" }
:if ($tmp ="/") do={}
}
:if ([:find $sysname " "] !=0) do={
:local name $sysname;
:local newname "";
:for i from=0 to=([:len $name]-1) do={ :local tmp [:pick $name $i];
:if ($tmp !=" ") do={ :set newname "$newname$tmp" }
:if ($tmp =" ") do={ :set newname "$newname_" }
}
:set sysname $newname;
}
:set textfilename ($"newdate" . "-" . $"sysname" . ".rsc")
:set backupfilename ($"newdate" . "-" . $"sysname" . ".backup")
:execute [/export file=$"textfilename"]
:execute [/system backup save encryption=aes-sha256 password=Backup_Encryption_Passsword name=$"backupfilename"]
:delay 5s
:log info "Sending Export File"
/tool fetch address=FTP_Server_IP src-path=($"newdate" . "-" . $"sysname" . ".rsc") user=username mode=ftp password=password dst-path=($"newdate" . "-" . $"sysname" . ".rsc") upload=yes
:log info "Sending Backup File"
/tool fetch address=FTP_Server_IP src-path=($"newdate" . "-" . $"sysname" . ".backup") user=username mode=ftp password=password dst-path=($"newdate" . "-" . $"sysname" . ".backup") upload=yes
:log info "Sending Completed"
:log info "Removing Backup files from router file list"
/file remove ($"newdate" . "-" . $"sysname" . ".rsc")
/file remove ($"newdate" . "-" . $"sysname" . ".backup")
:log info "Automated Backup Protocol Completed"