Pages

Saturday, March 10, 2012

P6-- Weekly Auto Mikrotik backup and send to mail.

To send an email with a regular backup of all system settings, three steps are needed. Firstly you must ensure you have set the outgoing email SMTP server settings in "tool email", then create the script that generates the backup file itself, lastly is to create a schedule to run that backup script on a regular basis.

Mail SMTP configure:
Code: [Select]
/ tool e-mail 
set server=1.2.3.4 from="samename@somewhere.com" 

"Generate a Backup" Script

Code: [Select]
/ system script
add name="backup_mail" source="/system backup save name=email_backup \n/tool \
   e-mail send file=email_backup.backup to=\"someone@somewhere.tld\" body=\"See \
   attached file for System Backup\" subject=\(\[/system identity get name\] \
   . \" \" .  \[/system clock get time\] . \" \" . \[/system clock get date\] \
   . \"  Backup\"\)\n"

"Weekly Scheduler" Script
Code: [Select]
/ system scheduler
add name="sched_backup_mail" on-event="backup_mail" start-date=jan/01/1970 start-time=07:30:00 interval=7d \
comment="" disabled=no

Every week at 7:30 am auto generate mikrotik backup and send to mail.

No comments:

Post a Comment