For some odd reason I lost all my past accounting on my router… erased… poof…gone…I did do a reboot last week, The loss may coincide with that, but I’m uncertain, can’t remember the exact time /day of reboot. I have rebooted today to see if that caused the current accounting to be lost, but it doesnt…Very curious. I have more than ample HD space.
Any thoughts on this.
Is there an easy way to have automatic backups created, if this happens again?
Using Version 4.6
What type of accounting (UserManager, IP Traffic, etc..)
You can only backup User Manager database if it’s not stored on the primary-master store. Then, you can pull the db file from the router using external tools (ex. wget), /tool fetch from a remote router, or locally to copy it to a different location.
Ex. To copy the db to a different location on the same router if active user manager store is on secondary-master:
First, create a backup directory in the root of your router’s ftp.
Then run fetch to copy the db to backup directory:
/tool fetch mode=ftp address=127.0.0.1 user="<user>" password="<pass>" src-path="secondary-master/user-manager/sqldb" dst-path="backups/um-backup"
P.S. I’m not sure how it handles copying during a write operation though, but for backup should be ok.
I’m using the User Manager with local Radius.
Usermanager is stored on the primary store.
I dug a bit more and found this command:
/tool user-manager database save name=BUuserman
Can i assuming that this will do what I want.
then just create a scheduler that will perform this once a day? like this:
add name=“backup_userman_database” on-event=“/tool user-man database save name=BUuserman”
start-date=jan/01/2010 start-time=23:00:00 interval=1d comment=“daily userman backup”
disabled=no
Question is: Is it possible to give it an incremental name for each new backup such as “BUuserman1…BUuserman2…” or by date. so as not to overwrite previous day. I would of course have to figure out a script to go in and clean out old ones, so as not to fill up HD… I guess ideally it would be great if I could get it so that the script wrote say a backup a day for 60 days and then started to write over old ones. hmmmmm
super thanks!
Interesting… I was not aware of the built-in User Manger save function.
As for incrementing names (such as date) try this:
:local fileprefix "BUuserman_"
# Internal processing below
# -------------------------------
:local filedate [/system clock get date]
:local filetime [/system clock get time]
:set filedate ([:pick $filedate 7 11] . [:pick $filedate 0 3] . [:pick $filedate 4 6])
:set filetime ([:pick $filetime 0 2] . [:pick $filetime 3 5] . [:pick $filetime 6 8])
/tool user-manager database save name=($fileprefix . $filedate . "-" . $filetime)
Yeah I had to dig a bit to find that command, somtimes the routeros documentation leaves a little to be desired, as far as finding things goes.
I see the logic here, although I dont know the syntax.
I"m getting this error at the “set:” command.
"expected variable name "
the terminal window with the command:
:set filedate ([:pick $filedate 7 11] . [:pick $filedate 0 3] . [:pick $filedate 4 6])
has the first letter of the first “filedate” highlighted red. so theres an error there somewhere.
thanks doug, much appreciated so far.
Basically, the error means you haven’t defined a variable yet, thus the ‘:local …’ near the beginning of my posted script.
Create a new script. Then copy and paste the code I posted. It should run fine after that.
ha thats funny,
I just figured it out like 30 seconds before your post, I was just looking it up to tell you…
thanks doug… 