... | ... | @@ -135,4 +135,86 @@ The application App2.5 terminated successfully. |
|
|
|
|
|
The lines starting with *Connected* and *The application* are written by the console whereas the lines starting with *Printing* come from the app itself as it was configured to stream its error and output.
|
|
|
|
|
|
The calls to *waitFor()* were blocking and the termination of *App2* unblocked them as an event was sent from the Cameo server to all the clients. The console received the error and output stream before stopping, the *connect* command being blocking. |
|
|
\ No newline at end of file |
|
|
The calls to *waitFor()* were blocking and the termination of *App2* unblocked them as an event was sent from the Cameo server to all the clients. The console received the error and output stream before stopping, the *connect* command being blocking.
|
|
|
|
|
|
# Using the console
|
|
|
|
|
|
The console *cmo* offers interesting features to start or monitor a Cameo environment. To print the help:
|
|
|
```
|
|
|
$ cmo
|
|
|
```
|
|
|
|
|
|
To display the list of registered apps that can be started:
|
|
|
```
|
|
|
$ cmo list
|
|
|
```
|
|
|
|
|
|
By default, the Cameo server is the local on the 7000 port but it can be configured.
|
|
|
If a Cameo server is running on the port 8000:
|
|
|
```
|
|
|
$ cmo -p 8000 list
|
|
|
```
|
|
|
|
|
|
If a Cameo server is running on *B*:
|
|
|
```
|
|
|
$ cmo -e tcp://B:7000 list
|
|
|
```
|
|
|
|
|
|
To start *App2* from localhost:
|
|
|
```
|
|
|
$ cmo start App2
|
|
|
```
|
|
|
|
|
|
The command immediately returns. Then it is possible to see if it is running:
|
|
|
```
|
|
|
$ cmo apps
|
|
|
Name ID PID Status Args
|
|
|
-------------------------------------------------
|
|
|
App2 5 9087 RUNNING
|
|
|
```
|
|
|
|
|
|
The *ID* is the id of the Cameo server which is unique different from the *PID* which is the common system process id.
|
|
|
|
|
|
We can connect to it now:
|
|
|
```
|
|
|
$ cmo connect App2
|
|
|
Printing 8
|
|
|
Printing 9
|
|
|
Printing 10
|
|
|
Q
|
|
|
```
|
|
|
The command is blocking and typing *ctl+c* or *shift+q* stops the command but not the app.
|
|
|
|
|
|
To stop *App2*:
|
|
|
```
|
|
|
$ cmo stop App2
|
|
|
```
|
|
|
|
|
|
As there is no stop handler defined for *App2*, the stop is equivalent to a kill, so we could have done:
|
|
|
```
|
|
|
$ cmo kill App2
|
|
|
```
|
|
|
|
|
|
To start *App2* with a blocking command, we can use:
|
|
|
```
|
|
|
$ cmo exec App2
|
|
|
Printing 1
|
|
|
Printing 2
|
|
|
Printing 3
|
|
|
Printing 4
|
|
|
^CKilled App2.6.
|
|
|
```
|
|
|
This time we typed *ctl+c* to kill the app. We could have used *shift+s* to cleanly stop the app or *shift+q* to exit the console without stopping the app which would still run in background.
|
|
|
|
|
|
Some additional commands and features can be interesting to know.
|
|
|
|
|
|
We saw that by default *cmo* contacts the local Cameo server on port 7000. You can change that by defining the *CAMEO_SERVER* environment variable e.g. with the *tcp://localhost:8000* which can be useful if you configured the Cameo server with that port.
|
|
|
|
|
|
You can display the Cameo server endpoint:
|
|
|
```
|
|
|
$ cmo endpoint
|
|
|
```
|
|
|
You can display the version of the server:
|
|
|
```
|
|
|
$ cmo version
|
|
|
``` |