Mikrotik backup to E-Mail

February 11th, 2014 | by admin |


/system script
add name=backup2email policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api source="log info \"Starting Automatic Backup to EMAIL Script\"\r\
\n:global thisdate [/system clock get date]\r\
\n:global datetimestring ([:pick \$thisdate 0 3] .\"-\" . [:pick \$thisdate 4 6] .\"-\" . [:pick \$thisdate 7 11])\r\
\n:global backupfilename ([/system identity get name].\"_\".\$datetimestring.\"_1w\")\r\
\n:global backupbin (\$backupfilename.\".backup\")\r\
\n:global backupexport (\$backupfilename.\".rsc\")\r\
\n:local smtp [:resolve smtp.gmail.com]\r\
\n:local emailto (\"your@mail.ru\")\r\
\n\r\
\n\r\
\n/system backup save name=\"\$backupfilename\"\r\
\n:delay 5s\r\
\n/export compact file=\"\$backupfilename\"\r\
\n:log info \"Please wait...!!!\"\r\
\n:delay 5s\r\
\n\r\
\n/tool e-mail send file=\"\$backupbin\" to=\"\$emailto\" server=\"\$smtp\" port=587 start-tls=yes subject=\"mikrotik \$backupfilename BIN\"\r\
\n:delay 5s\r\
\n/file remove \$backupbin\r\
\n\r\
\n/tool e-mail send file=\"\$backupexport\" to=\"\$emailto\" server=\"\$smtp\" port=587 start-tls=yes subject=\"mikrotik \$backupfilename TXT\"\r\
\n:delay 5s\r\
\n/file remove \$backupexport"
/system scheduler
add interval=1d name=backup2email on-event=backup2email policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api start-date=feb/11/2014 start-time=\
09:47:25
/tool e-mail
set address=66.249.93.111 from=mikrotik@mail.ru password=MEGAPASS port=587 start-tls=yes user=robot@gmail.com

Post a Comment

*