Community discussions

MikroTik App
 
ColinSlater
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 59
Joined: Sun Sep 12, 2021 2:32 pm

Automatic Config Backup --> Not working in December

Fri Dec 02, 2022 11:01 am

Good Morning Mikrotik Community,
I found a script on a forum post here somewhere for doing automatic backup of the config. I adapted it a bit to do what I wanted it to do, and it's been working fine throughout November, creating a backup file every day.
Seems to have stopped working now that we're in December though, and I have no clue why - this is only the second script that I've ever worked with...
:local theDate [/system clock get date]
:local theDay [ :pick $theDate 4 6 ]
:local theMonth [ :pick $theDate 1 3 ]
:local theMonthNumber ([:find "xxanebarprayunulugepctovecANEBARPRAYUNULUGEPCTOVEC" "ov" -1] / 2); 
:if ($theMonthNumber>12) do={:set theMonthNumber ($theMonthNumber - 12)}
:if ($theMonthNumber < 10) do={:set theMonthNumber "0$theMonthNumber"}
:local theYear [ :pick $theDate 7 11 ]
:local exportFileName "$theYear-$theMonthNumber-$theDay_RB4011.rsc"
export terse show-sensitive file="$exportFileName"
It should produce a file like "2022-12-01_RB4011.rsc", obviously changing the date each day.

Any thoughts?

Thanks very much.
 
matiss
MikroTik Support
MikroTik Support
Posts: 24
Joined: Fri Dec 30, 2016 10:13 am

Re: Automatic Config Backup --> Not working in December

Fri Dec 02, 2022 11:40 am

Replace "ov" with $theMonth
 
ColinSlater
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 59
Joined: Sun Sep 12, 2021 2:32 pm

Re: Automatic Config Backup --> Not working in December

Fri Dec 02, 2022 3:40 pm

Thanks very much :)
That's fixed it!
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Automatic Config Backup --> Not working in December

Sat Dec 03, 2022 1:43 pm

Try to not blindly copy&paste scripts
The script here
viewtopic.php?p=968074#p968074
{
:local M ([:find "xxanebarprayunulugepctovecANEBARPRAYUNULUGEPCTOVEC" "ov" -1] / 2); :if ($M>12) do={:set M ($M - 12)}
:put $M
}
is obviously one example for november,
 
ColinSlater
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 59
Joined: Sun Sep 12, 2021 2:32 pm

Re: Automatic Config Backup --> Not working in December

Tue Aug 29, 2023 2:33 am

Hi Everyone,
Noticed some strange behaviour that seems to have been happening for a while.
My backup script, which has been happily running for months, suddenly stopped generating the filenames as expected.
Instead of getting something like 2023-08-29_RB4011.rsc (obviously, the date part is dynamic, as per the script here), I'm getting something like this:

-29-0--0_RB4011.rsc

Anyone got any thoughts?

We've not changed the script, but since implementing the script last year, we have updated the ROS a few times - currently running ROS 7.10.

Thanks

Colin
 
User avatar
diamuxin
Member
Member
Posts: 317
Joined: Thu Sep 09, 2021 5:46 pm
Location: Alhambra's City

Re: Automatic Config Backup --> Not working in December

Tue Aug 29, 2023 9:42 am

share your backup script so they can help you...
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Automatic Config Backup --> Not working in December

Tue Aug 29, 2023 12:03 pm

Anyone got any thoughts?
Yep, you clearly don't read the release notes at all and update the system without even a clue what you're doing.

From RouterOS 7.10 the dates are FINALLY reported in the right and more logical ISO:8601 yyyy-MM-dd format instead of the <censored> Mmm/dd/yyyy

Now, if the script is the same of the OP, can you replace all on RouterOS 7.10+ with simply:

revised untested code

/export terse show-sensitive file="$[/sys clock get date]_RB4011.rsc"
 
ColinSlater
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 59
Joined: Sun Sep 12, 2021 2:32 pm

Re: Automatic Config Backup --> Not working in December

Sat Sep 02, 2023 12:57 am

Thanks for the kind words in your reply.
I’ll update my script.

Who is online

Users browsing this forum: nocivo and 15 guests