I'm trying to automate the setup of karaf server by issuing commands through bin/client. But I have the following issues:
- After starting bin/start, I have no idea how long I need to wait before karaf can start accepting commands
- After each command via bin/client, the subsequent bin/client commands will fail with message 'Failed to acquire the session' for some time, it looks like the previous command is still executed and I must wait some unpredictable amount of time for it to finish.
- After issuing commands, I need to stop karaf. But as long as I don't know if the last command has finished, I can't do that.
Is there a way to ask if the bin/client is ready to accept next command, or, even best, wait in script until that happens?
来源:https://stackoverflow.com/questions/43066208/how-to-detect-if-karaf-is-ready-to-accept-commands-via-client