Difference between revisions of "Ros3 Backup Del Mail"

From CTWUG Wiki
Jump to: navigation, search
(New page: =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...)
 
Line 10: Line 10:
 
* Check out **** to create a schedule, that will run the script at a predefined period.
 
* Check out **** to create a schedule, that will run the script at a predefined period.
  
 +
==Script==
 
<code>
 
<code>
 
:log info "backup beginning now"
 
:log info "backup beginning now"

Revision as of 11:13, 18 November 2008

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"