Backup script not working on rb

Die script wat ek op rb het werk nie reg nie, hy is veronderstel om elke dag 'n backup te maak teen 11:00 elke oggend.

Wil graag weet of ek iets uitgelaat of verkeerd gedoen het.
dis die script wat ek geload het op my rb, maar ek moet hom manually run om backup te create.

:do {
:local date [/system clock get date]
:local d [:pick $date 4 6]
:local m [:pick $date 0 3]
:local y [:pick $date 7 11]
:if ($m="jan") do={:set m "01"};
:if ($m="feb") do={:set m "02"};
:if ($m="mar") do={:set m "03"};
:if ($m="apr") do={:set m "04"};
:if ($m="may") do={:set m "05"};
:if ($m="jun") do={:set m "06"};
:if ($m="jul") do={:set m "07"};
:if ($m="aug") do={:set m "08"};
:if ($m="sep") do={:set m "09"};
:if ($m="oct") do={:set m "10"};
:if ($m="nov") do={:set m "11"};
:if ($m="dec") do={:set m "12"};
:set date ($m.$d.$y);
/system backup save name=$date;
:delay 3s;
:foreach i in=[/file find] do={
:local name [/file get $i name];
:if ([:len [/file get $i name]]="15") do={
:local m1 [:pick $date 0 2];
:local y1 [:pick $date 4 8];
:local m2 [:pick $name 0 2];
:local y2 [:pick $name 4 8];
:if ($y1=$y2 && m2 < $m1) do={
/file remove $name};
:if ($y1 > $y2) do={
/file remove $name}}}};

@apex, do you have a wug e-mail address? If yes, I can give you the script I use.

:log info “RB1_backup: RB1 Backup Job Started
:global backupfile rb1-backup
:global rbsmtp
:set rbsmtp [:resolve “172.18.1.12”];
:log info “RB1_backup: Deleting old Backup Files”
/system backup save name=$backupfile dont-encrypt=no
:log info “RB1_backup: Backup process pausing for 30s so that it may create Backup Files
:delay 30s
:log info “RB1_backup: Start Sending Backup File via Email
/tool e-mail send to=“mywugmail@ctwug.za.net” password=wugmailpasssword subject=([/system clock get date] .
RB1 - Backup File Export”) from=mywugmail@ctwug.za.net file=$backupfile server=$rbsmtp start-tls=yes
:delay 60s
:log info “RB1_backup: Backup Finished
:log info “RB1_backup: Deleting Backup File. All Done
/file remove $backupfile

2 Likes

This script will create a backup of your device and mail the backup to you. This only works if you have a Wug e-mail address. Alternatively if your RB has internet access you could use your ISP’s smtp server.

2 Likes

There are many ways to do backups on MT Devices, are you specifically needing the one that you posted to work, or are you merely wanting a backup of your RB’s?

I have the following script that I run, it creates 2 files, 1 x backup file and 1 x .rsc export file.
It is has the requirement of an CTWUG Email account, which you can read up on here

I have configured, under /tool email:

The below runs as a /system schedule

/system backup save name="$[/system identity get name]";
/export file="$[/system identity get name]";
:delay 30;
/tool e-mail send to="xyz@ctwug.za.net" body="See attached file from. $[/system identity get name] $[/system clock get time] $[/system clock get date] Backup" subject="$[/system identity get name] 1/2 $[/system clock get time] $[/system clock get date] Backup" file="$[/system identity get name].rsc";
:delay 60;
/tool e-mail send to="xyz@ctwug.za.net" body="See attached file from. $[/system identity get name] $[/system clock get time] $[/system clock get date] Backup" subject="$[/system identity get name] 2/2 $[/system clock get time] $[/system clock get date] Backup" file="$[/system identity get name].backup";

This script does not remove the file from the RB, but does replace it on next run, so does not clutter your storage, also serves as an additional copy of the backup.

4 Likes

Hi, ek het die script getoets en dit werk, dit skep 'n backup file elke dag van die maand.

Ek gaan dit op my RB loop en sal terug kom met resultate.
Die script stoor net die backup op die RB.

Dit wil voorkom dat jy dalk nie 'n schedule opgestel het hiervoor nie.

Daar is 2 maniere om dit te doen:

  1. As jy dit wil manually kan afskop, dan stel ek voor dat jy 'n script opstel, tweede stap sal wees om 'n schedule op te stel wat die script roep:

  2. As jy dit net automaties wil laat loop kan jy jou script net in die schedule plaas:

Meer oor scripts
Meer oor Scheduling

en dan 'n klomp voorbeelde

4 Likes

Thanks JellyBean, busy playing with it now…

1 Like

Thanks @Firestarter will give it a try

1 Like

Thanks Jelly, took your advice, everything seems to be working 100%.

See uploaded pic, the interval, can that be changed to backup every 2nd or 4th day?..just a question, if so thanks again.

1 Like

You can set the interval to whatever you want.

xd hh:mm:ss

x being the number of days
hh - hours
mm - minutes
ss - seconds

for example: you set the start time to 23:00:00 and the interval to 2d 01:00:00
day1: 23:00:00
day3: 00:00:00
day5: 01:00:00
day7: 02:00:00
etc

2 Likes

Thanks for the confirmation @JellyBean

2 Likes