Automated Backups Posted by butche
on December 22 2006 20:11
# Set the NTP servers below.
/ system ntp client set enabled=yes mode=unicast primary-ntp=24.79.76.105 \ secondary-ntp=24.123.66.139
# This will create a text backup of your system and email it to an email # address of your choice. The easiest way to insure you get this right # is to cut/paste this text into notepad, then search and replace the # following text with appropriate values. # you@yourdomain.com - replace with your email address # X.X.X.X - replace with your mailservers IP ADDRESS (not dns name) # # VERY IMPORTANT - this script will not run correctly if the system name # is set with a space in it. You can fix this by going to SYSTEM->IDENTITY # in Winbox.
/ system script add name="makebackup" source=":log info \"Starting Backup Script\"\n \ /export file=\[/system identity get name\]\n \ :delay 20\n /tool e-mail send to=you@yourdomain.com \ subject=\(\[/system identity get name\] . \" \ Backup\"\) from=you@yourdomain.com \ file=\(\[/system identity get name\] . \".rsc\"\) \ server=X.X.X.X \n:log info \"Finished Backup Script\"" \ policy=ftp,reboot,read,write,policy,test
# Set the interval here to schedule the above backup script every # day/week/month (or hour if you want). Don't mess with the start # date or start time unless you have a good reason to do so
The above script can be tested in Winbox by clicking: SYSTEM->SCRIPT, then highlight the makebackup entry and click RUN. You will see entries in the log (click LOG to view these) to indicate the script starting and stopping. When it completes, check your email to insure you get the email with the backup attached. You can view further information about how to use the output of this script HERE .