Difference between revisions of "NOC:ctwug backup"
From CTWUG Wiki
Bigmikedavis (talk | contribs) (New page: == Purpose == == Dependencies == == Script == == WMS == Wug Management System) |
|||
| (3 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
== Purpose == | == Purpose == | ||
| + | * Finds and deletes any existing backups | ||
| + | * Creates a backup | ||
| + | * Emails the backup file to the ctwug backup server email address | ||
== Dependencies == | == Dependencies == | ||
| + | * email address: backup@ctwug.za.net | ||
| + | * email server : 172.18.55.25 | ||
== Script == | == Script == | ||
| − | + | :local fid [/system identity get name] | |
| − | == | + | :local fserial [/system routerboard get serial-number] |
| − | [ | + | |
| + | :if ( [/file find name=ctwug-auto.backup] != "" ) do=[/file remove ctwug-auto.backup] | ||
| + | :delay 1 | ||
| + | /system backup save name=ctwug-auto | ||
| + | :local fwait 1 | ||
| + | :local fcnt 0 | ||
| + | :while ( $fwait = 1 ) do={ | ||
| + | :set fcnt ($fcnt+1) | ||
| + | :log info ("ctwug_backup sleep ".$fcnt) | ||
| + | :delay 1 | ||
| + | if ([/file find name=ctwug-auto.backup] != "") do={ :set fwait 0; } | ||
| + | if ( $fcnt = 20) do={ | ||
| + | :log info "ctwug_backup FAILED"; | ||
| + | :set fwait 0; | ||
| + | }; | ||
| + | }; | ||
| + | :local femail backup@ctwug.za.net | ||
| + | :local fserver 172.18.55.25 | ||
| + | /tool e-mail send server=$fserver from=$femail to=$femail subject="$fid/$fserial" file=ctwug-auto.backup | ||
Latest revision as of 18:07, 30 June 2013
Purpose
- Finds and deletes any existing backups
- Creates a backup
- Emails the backup file to the ctwug backup server email address
Dependencies
- email address: backup@ctwug.za.net
- email server : 172.18.55.25
Script
:local fid [/system identity get name]
:local fserial [/system routerboard get serial-number]
:if ( [/file find name=ctwug-auto.backup] != "" ) do=[/file remove ctwug-auto.backup]
:delay 1
/system backup save name=ctwug-auto
:local fwait 1
:local fcnt 0
:while ( $fwait = 1 ) do={
:set fcnt ($fcnt+1)
:log info ("ctwug_backup sleep ".$fcnt)
:delay 1
if ([/file find name=ctwug-auto.backup] != "") do={ :set fwait 0; }
if ( $fcnt = 20) do={
:log info "ctwug_backup FAILED";
:set fwait 0;
};
};
:local femail backup@ctwug.za.net
:local fserver 172.18.55.25
/tool e-mail send server=$fserver from=$femail to=$femail subject="$fid/$fserial" file=ctwug-auto.backup