This is copied from WinBox because in my opinion it's easier to read than an export. If you want the export version, just ask.
The first part creates the backup, export and version files.
Next is to send some of those files via E-Mail.
Last is to use ftp to transfer the files to my file server. My server is running FileZilla as a ftp server. It is configured not to allow any access from off my local LAN.
What is not shown here is a command file on the server that adds the date to the filenames. That is run via the task scheduler a few minutes after the routers ftp the files to the server. Lastly, there is another command file that runs at the end of every month and zips all the files into a monthly zip file.
This script is run every night at 2231 local time (router 2 does the same at 2232, and router 3 does the same at 2233).
# Policies needed: ftp, read, policy, sensitive, test, write
# Policies NOT needed: password, reboot, sniff, romon
:log info "Starting daily backup";
/system backup save name=RB4011_Daily
/export file=RB4011_Daily
/system package print file=RB4011_Version.txt
:delay 00:00:01
/tool e-mail send file=RB4011_Daily.backup to="<e-mail address>" body="4011 Router daily backup file attached." \
subject="RB4011 $[/system clock get date] at $[/system clock get time] Backup"
:delay 00:00:10
/tool e-mail send file=RB4011_Daily.rsc,RB4011_Version.txt,log.0.txt to="<e-mail address>" body="Router #1 daily script and version files attached." \
subject="RB4011 $[/system clock get date] at $[/system clock get time] Script"
:delay 00:00:10
/tool fetch address=192.168.201.11 src-path="RB4011_Daily.backup" user=<Redacted> mode=ftp password="<Redacted>" port=21 dst-path="RB4011_Daily.backup" upload=yes
:delay 00:00:03
/tool fetch address=192.168.201.11 src-path="RB4011_Daily.rsc" user=<Redacted> mode=ftp password="<Redacted>" port=21 dst-path="RB4011_Daily.rsc" upload=yes
:delay 00:00:03
/tool fetch address=192.168.201.11 src-path="RB4011_Version.txt" user=<Redacted> mode=ftp password="<Redacted>" port=21 dst-path="RB4011_Version.txt" upload=yes
:delay 00:00:03
/tool fetch address=192.168.201.11 src-path="log.0.txt" user=<Redacted> mode=ftp password="<Redacted>" port=21 dst-path="RB4011_log.0.txt" upload=yes
:delay 00:00:03
/tool fetch address=192.168.201.11 src-path="log.1.txt" user=<Redacted> mode=ftp password="<Redacted>" port=21 dst-path="RB4011_log.1.txt" upload=yes
:log info "Daily backup script completed"
Is this a perfect script, likely no, but it serves my purposes.
Just because I can, here is the windows filename rename command file - runs at 2245 nightly:
Rename RB4011_Daily.backup %date:~10,4%-%date:~4,2%-%date:~7,2%_RB4011_Daily.backup
Rename RB4011_Daily.rsc %date:~10,4%-%date:~4,2%-%date:~7,2%_RB4011_Daily.rsc
Rename RB4011_Version.txt %date:~10,4%-%date:~4,2%-%date:~7,2%_RB4011_Version.txt
Rename RB4011_log.0.txt %date:~10,4%-%date:~4,2%-%date:~7,2%_RB4011_log.0.txt
Rename RB4011_log.1.txt %date:~10,4%-%date:~4,2%-%date:~7,2%_RB4011_log.1.txt
Rename RB750r2_Daily.backup %date:~10,4%-%date:~4,2%-%date:~7,2%_RB750r2_Daily.backup
Rename RB750r2_Daily.rsc %date:~10,4%-%date:~4,2%-%date:~7,2%_RB750r2_Daily.rsc
Rename RB750r2_Version.txt %date:~10,4%-%date:~4,2%-%date:~7,2%_RB750r2_Version.txt
Rename RB750r2_log.0.txt %date:~10,4%-%date:~4,2%-%date:~7,2%_RB750r2_log.0.txt
Rename RB750r2_log.1.txt %date:~10,4%-%date:~4,2%-%date:~7,2%_RB750r2_log.1.txt
Rename RB750Gr3_Daily.backup %date:~10,4%-%date:~4,2%-%date:~7,2%_RB750Gr3_Daily.backup
Rename RB750Gr3_Daily.rsc %date:~10,4%-%date:~4,2%-%date:~7,2%_RB750Gr3_Daily.rsc
Rename RB750Gr3_Version.txt %date:~10,4%-%date:~4,2%-%date:~7,2%_RB750Gr3_Version.txt
And the end of the month windows zip command file - runs at 2250 local time on the last day of each month.
"c:\program files\7-zip\7z" a -tzip monthly.zip *.backup
"c:\program files\7-zip\7z" a -tzip monthly.zip *.rsc
"c:\program files\7-zip\7z" a -tzip monthly.zip *.txt
Rename Monthly.zip %date:~10,4%-%date:~4,2%_Monthly.zip
del *.backup
del *.rsc
del *.txt