themoos/essential-moos — pull request #2 by ifreecarve (2013-10-28 21:32:27+00:00)
Title: pAntler + GNU screen

Launch Processes in GNU Screen
=========================

This patch is a refactor of pAntler in order to add a new launch option: GNU screen (http://en.wikipedia.org/wiki/GNU_Screen).

The major benefit of launching screens is that unlike `Newconsole = false` (in which stdout/stderr text isn't visible) and `Newconsole = true` (in which the window with the program output is _always_ visible), **screen sessions provide a way to connect to a running process when needed, without putting xterms in your face**.

Before
----------

This is an example of a pAntler config block.
```
ProcessConfig = ANTLER
{
Run = MOOSDB @ Newconsole=true, XConfig=blah ~ MOOSDB
blah = -geometry,80x40+0+20
}
```

After
-------
`LaunchType` replaces `NewConsole` (which is now the fallback option). `LaunchType` may be (case-insensitively) `Process`, `Console`, or `Screen`.

Here's the same block with the new configuration style.
```
ProcessConfig = ANTLER
{
Run = MOOSDB @ LaunchType=Process, XConfig=blah ~ MOOSDB
blah = -geometry,80x40+0+20
}
```

Better
--------
Here's how to launch it in a screen. We're adding the `ScreenConfig` option `-L` which enables logging for the console output, but this is entirely unnecessary; it's here for demonstration.

```
ProcessConfig = ANTLER
{
Run = MOOSDB @ LaunchType=Process, ScreenConfig=blah ~ MOOSDB
blah = -L
}
```

Running pAntler will launch this screen session. You can observe it by typing `screen -ls` in a terminal. You'll get something like the following:
```
$ screen -ls
There is a screen on:
16833.MOOSDB	(10/28/2013 05:30:37 PM)	(Detached)
1 Socket in /var/run/screen/S-xxx.

```

And if you type `screen -R MOOSDB`, you can connect to it:

```
***************************************************
* This is MOOS Server for Community "#1"
* c. P Newman 2001
*
* Binding on 9000
*
* This machine is Little endian
***************************************************

------------CONNECT-------------
New client connected from machine "localhost"
Handshaking....done
clients name is "DBWebServer"
There are now 1 clients connected.
--------------------------------

*****************************************************
serving webpages HTTP on http://xxxxx:9080
*****************************************************

```