Community discussions

MikroTik App
 
ahmedakkaya
just joined
Topic Author
Posts: 20
Joined: Mon Oct 17, 2016 6:09 pm

SD card backup

Thu Nov 10, 2016 2:17 pm

Hello there
micro SD card into i back up a script

Image
 
proximus
Member Candidate
Member Candidate
Posts: 119
Joined: Tue Oct 04, 2011 1:46 pm

Re: SD card backup

Thu Nov 10, 2016 3:35 pm

/system backup save name="/disk1/backup_name"
Even better, this nice backup script continues on to ftp the backup to another destination.
http://harry.subnetworx.de/2013/12/27/a ... ackup-ftp/
But, you could strip out the the ftp and local file delete parts. That would leave you with unique file names on the SD each time it runs.
You would have to edit the file destination to use disk1, like this:
/system backup save name="/disk1/$fname1"
:log info message="System backup finished.";
/export compact file="/disk1/$fname2"
 
ahmedakkaya
just joined
Topic Author
Posts: 20
Joined: Mon Oct 17, 2016 6:09 pm

Re: SD card backup

Thu Nov 10, 2016 6:21 pm

/system backup save name="/disk1/backup_name"
Even better, this nice backup script continues on to ftp the backup to another destination.
http://harry.subnetworx.de/2013/12/27/a ... ackup-ftp/
But, you could strip out the the ftp and local file delete parts. That would leave you with unique file names on the SD each time it runs.
You would have to edit the file destination to use disk1, like this:
/system backup save name="/disk1/$fname1"
:log info message="System backup finished.";
/export compact file="/disk1/$fname2"
Thank you :D
 
Rudios
Forum Veteran
Forum Veteran
Posts: 972
Joined: Mon Mar 11, 2013 12:58 pm
Location: The Netherlands

Re: SD card backup

Thu Nov 10, 2016 9:35 pm

I would go for the export feature!
The big downside to making a backup is that it could only be restored on the same type device, with exact same RouterOS version.
When creating an export (rsc file) you could alter fhe file if needed and load it on practical any replacement device when needed.

[EDIT]
I have put together this script a while back and it integrates the date and device's identity.
#************************************************************************************************
# Parameters
#************************************************************************************************

# First get the identity for the Export file name
:local ConfigExportName [/system identity get name]

# get current date in format mm/DD/YYYY
:local date [ /system clock get date ]

# convert to YYYYMMDD
:local months ("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");
:local month [ :pick $date 0 3 ]; :local day [ :pick $date 4 6 ]; :local year [ :pick $date 7 11 ];
:local mm ([ :find $months $month -1 ] + 1);
:if ($mm < 10) do={ :set month ("0" . $mm); } else={ :set month $mm; }
:set date ($year . "-" . $month . "-" .  $day);

:set ConfigExportName ($ConfigExportName . "_" . $date);

:put $ConfigExportName

/export file=$ConfigExportName

:log info ("$ConfigExportName created succesfully!");
Alter it with info from the previous posts and it will save to SD card.

PS.
Adding the compact parameter is not needed anymore since RouterOS 6, it does compact by default.
 
ahmedakkaya
just joined
Topic Author
Posts: 20
Joined: Mon Oct 17, 2016 6:09 pm

Re: SD card backup

Thu Nov 10, 2016 9:46 pm

You need to share the script required for .RSC?
 
Rudios
Forum Veteran
Forum Veteran
Posts: 972
Joined: Mon Mar 11, 2013 12:58 pm
Location: The Netherlands

Re: SD card backup

Thu Nov 10, 2016 9:48 pm

rsc is the result of export
 
ahmedakkaya
just joined
Topic Author
Posts: 20
Joined: Mon Oct 17, 2016 6:09 pm

Re: SD card backup

Thu Nov 10, 2016 9:51 pm

How do i take backup of .rsc extension to disk1

Who is online

Users browsing this forum: Bing [Bot], quanbau and 16 guests