I have something like this running as well. I figure I have 6 years+ on gmail until I run out of space for my daily backups.

I do an export to a text file and then mail that. I have just had too many issues with binary files when I have to replace non-like hardware in a pinch.

ryan

On 1/15/14 7:05 PM, Josh Luthman wrote:
Not off list.  I expect the backups to be dated in Gmail.

Josh Luthman
Office: 937-552-2340
Direct: 937-552-2343
1100 Wayne St
Suite 1337
Troy, OH 45373
On Jan 15, 2014 10:02 PM, "Grand Avenue Broadband" <
[email protected]> wrote:

On Jan 15, 2014, at 7:42 PM, Mike Lyon <[email protected]> wrote:

Howdy,

Anyone have a Mikrotik backup shell script they could share?

Thanks,
Mike
[offlist]

This script deletes all older backup files, then creates

    auto-backup.ROUTERNAME.YYYY-mmm-dd.hhmmss.backup and
    auto-backup.ROUTERNAME.YYYY-mmm-dd.hhmmss.rsc

and mails both of them to an address of your choosing.  Requires /tool
e-mail to be set up beforehand.

/system script
add name=auto-backup policy=\
     ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
     source="# delete previous auto backup files\r\
     \n#\r\
     \n:foreach i in=[/file find] do={\r\
     \n    :local name [/file get \$i name]\r\
     \n    :if ([:pick \$name 0 12] = \"auto-backup.\") do={\r\
     \n          :log info \"Deleting file \$name\"\r\
     \n          /file remove \$i\r\
     \n          }\r\
     \n    }\r\
     \n#\r\
     \n# assemble current file name\r\
     \n#\r\
     \n:global curdt [/system clock get date]\r\
     \n:global newdt (\"\$[:pick \$curdt 7 11]-\$[:pick \$curdt 0
3]-\$[:pick \
     \$curdt 4 6]\")\r\
     \n:global curtm [/system clock get time]\r\
     \n:global newtm (\"\$[:pick \$curtm 0 2]\$[:pick \$curtm 3 5]\$[:pick
\$cu\
     rtm 6 8]\")\r\
     \n:global subject (\"of \$[/system identity get name] (\$[/system
routerbo\
     ard get model])\")\r\
     \n:global filename (\"auto-backup.\$[/system identity get
name].\$newdt-\$\
     newtm\")\r\
     \n#\r\
     \n# do the backup\r\
     \n#\r\
     \n:log info \"Creating \$filename.rsc and \$filename.backup\"\r\
     \n/export compact file=\$filename\r\
     \n/system backup save name=\$filename\r\
     \n:delay 15s\r\
     \n/tool e-mail send file=\"\$filename.rsc\"
to=\"DESIRED-EMAIL-ADDRESS-HERE\" body=\"Backup file attached.\\n\\n\"
subject=\"Auto-export \$subjec\
     t\"\r\
     \n:delay 15s\r\
     \n/tool e-mail send file=\"\$filename.backup\"
to=\"DESIRED-EMAIL-ADDRESS-HERE\" body=\"Backup file attached.\\n\\n\"
subject=\"Auto-backup \$sub\
     ject\"\r\
     \n:log info \"Auto backup sent\""

/system schedule
add interval=3d12h name=backups on-event=auto-backup policy=\
     ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
     start-date=jan/01/2014 start-time=12:00:00

_______________________________________________
Mikrotik mailing list
[email protected]
http://mail.butchevans.com/mailman/listinfo/mikrotik

Visit http://blog.butchevans.com/ for tutorials related to Mikrotik
RouterOS

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.butchevans.com/pipermail/mikrotik/attachments/20140115/84ee5317/attachment.html>
_______________________________________________
Mikrotik mailing list
[email protected]
http://mail.butchevans.com/mailman/listinfo/mikrotik

Visit http://blog.butchevans.com/ for tutorials related to Mikrotik RouterOS

_______________________________________________
Mikrotik mailing list
[email protected]
http://mail.butchevans.com/mailman/listinfo/mikrotik

Visit http://blog.butchevans.com/ for tutorials related to Mikrotik RouterOS

Reply via email to