PshellServer._gPshellClient = True # supress the automatic invalid arg count message from the PshellControl.py # module so we can display the returned usage PshellControl._gSupressInvalidArgCountMessage = True # register our callback commands PshellServer.addCommand( _add, "add", "add a new remote server or multicast group entry", "{server <localName> <remoteServer> [<port>]} | {multicast <keyword> <localName1> [<localName2>...<localNameN>]}", 4, 30, False) PshellServer.addCommand(_show, "show", "show aggregated servers or multicast group info", "servers | multicast", 2, 2, True) PshellServer.addCommand( _multicast, "multicast", "send multicast command to registered server group", "<command>", 2, 30, False) # start our local pshell server PshellServer.startServer("pshellAggregator", PshellServer.LOCAL, PshellServer.BLOCKING) # disconnect all our remote control servers PshellControl.disconnectAllServers() # cleanup our local server's resources PshellServer.cleanupResources()
def _cleanupAndExit(): PshellServer.cleanupResources() PshellControl.disconnectAllServers() sys.exit()
def signalHandler(signal, frame): PshellServer.cleanupResources() print("") sys.exit()