Page 1 of 1

Feature Request (improvement)

Posted: Wed May 10, 2006 12:55 pm
by Belyivulk
What would be useful (nice) and im not sure it exists, when a client with a MT router shuts down the router, or if the router looses power when it comes back up an event message sent back to the log of the AP its connecting too explaining if it were power outage, deliberate shutdown, lost wireless, or whatever the case may be. Helps to diagnose faults.

Posted: Wed May 10, 2006 1:10 pm
by cmit
You already have a log entry in the clients' log stating "unclean reboot because of power failure" or something along that lines if it was a un-clean shutdown. You could just look into the log of the client (which you probably can arrange access to)...

Best regards,
Christian Meis

Posted: Wed May 10, 2006 1:20 pm
by normis
plus, use the safe mode (crtl+x) so that unwanted shutdowns or disconnections don't happen

Posted: Thu May 11, 2006 2:00 pm
by Belyivulk
Go on? Ctrl-X how does that work?

I was looking at a router last night that just "vanished" off our network, but still remained pingable (hard to explain) and at first i thought the client had restarted, i couldnt get into mac telnet or winbox and there was nothing in the logs on the ap to suggest a reboot. In that situation a log in the AP would be handy i suppose. Turned out the gf unplugged it to connect a hair curler, but as it was a new link installed in the afternoon over a particularly long distance we were watching it like hawks.

Anyway, CTRL-X. What do you mean normis?

Posted: Thu May 11, 2006 2:08 pm
by normis
hit ctrl+x and it will start safe mode. in this mode you can do all the same stuff, but if by some mistake you manage to disconnect from the router (disable all interfaces for example) then the safe mode will undo the last actions and you will be able to connect again.

Posted: Thu May 11, 2006 2:11 pm
by Belyivulk
You have just made my day. I love you. I want you to have my babies! I was unaware of this feature that could make my life SOOOOOO much easier!

At which stage do i press ctrl-x?

Posted: Thu May 11, 2006 2:19 pm
by normis
any stage. in winbox you open the terminal window and hit ctrl+x there. the safe mode will then stay enabled for all that you do in either terminal or winbox. to turn it off, again hit ctrl+x in terminal.

in general you go to safe mode before attempting some important configuration

we will make a button for it in winbox

Posted: Thu May 11, 2006 2:22 pm
by Belyivulk
Great! that will stop ALOT of misshaps that we seem to encounter, for example choosing a frequency that "bricks" the router. If it would switch back to the original freq and re-establish connection now THAT is handy

Posted: Thu May 11, 2006 7:00 pm
by changeip
Normis,

Allowing for safe mode in a script also would be handy as well... using SSH to run commands or scripting to run commands and being able to turn on/off safe mode would be good. As well as being able to detect safe mode.

:safe on
:safe off
:put [:safe]

Sam

Posted: Tue May 23, 2006 8:12 pm
by eflanery
It is quite possible to take safe mode in remote scripts, this little chunk of python (similar constructs are possable in other languages, of course) is what I use:
    def lock(self, take):
        tries = 0
        success = -1
        modes = [["] > "], ["] <SAFE> "]]
        try:
            self.refreshconnection()
            while success != 0:
                if tries >= 30:
                    raise error("Locking failed")
                tries = tries + 1
                self.connection.write("\x18\n")
                success = self.connection.expect(modes[take], 1)[0]
        except:
            raise error("Locking failed")
The important part is this: self.connection.write("\x18\n")

Particularly, the \x18\n bit.

The \x18 sends a literal ^x, and the \n sends a newline which generates a fresh prompt.

Very useful for preventing multiple asynchronous scripts from colliding, and leaving the router in an indeterminate state (and preventing the script from locking itself, and you, out of the router). It can be used just like a thread lock, and could even be abstracted further to create semaphores and such.

--Eric

Posted: Tue May 23, 2006 8:24 pm
by changeip
Thats excellent!

I would still like to see some ice commands for placing the router into safe mode for scripting directly on the MT ... many scripts I run directly from the MT scripting language and there isn't a way I know of the place router into safe mode directly.

Sam

Posted: Tue May 23, 2006 8:38 pm
by eflanery
Indeed, I know of no way to initiate safe mode from within local MT scripts.

Would be quite useful.

--Eric