Ros3 Backup Del Mail

From CTWUG Wiki
Jump to: navigation, search

Info

This script will create a backup of your RB's configuration, email it to the recipent and then delete the file from the RB. It is just nice and very usefull to have a backup of your RB's configuration in your mailbox. This script will work as is, just navigate to System/Scripts and run it. Note the comments in the script that is written to the Log file.

Setup

For this script to function correctly, there are a few things that will need to be setup.

Enhancements

  • Check out **** to create a schedule, that will run the script at a predefined period.

Script

:log info "backup beginning now"
/system backup save name=([/system identity get name] . "-" . [:pick [/system clock get date] 4 6] . [:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 7 11]); 
:log info "Backup done"
:log info "backup being emailed"
/tool e-mail send to="abc@abc.com" subject=([/system identity get name] . " Backup " . [/system clock get date]) file=([/system identity get name] . "-" . [:pick [/system clock get date] 4 6] . [:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 7 11] . ".backup") from=([/system identity get name] . "@abc.rb") server=smtp.abc.net;
:log info "Email Send"
:log info "backup pausing for 5s"
:delay 5s
:log info "Delete File"
/file rem [/file find name=([/system identity get name] . "-" . [:pick [/system clock get date] 4 6] . [:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 7 11] . ".backup")]; 
:log info "File Deleted"
:log info ("System Backup emailed at " . [/sys cl get time] . " " . [/sys cl get date])
:log info "backup finished"