On Wed, May 27, 2015 at 07:25:59AM +0200, Alexander Burger wrote:
> The file <names> holds a configuration for the servers to be started.
> This is the part which still needs to be documented.

Hmm, actually this is rather simple.

Create a file with one server per line. For example, here some lines
from my config file for the wiki and some demo apps:

   app     8080 app  /home/app  log/app    ./pil app/main.l lib/app.l -main 
app/_patch.l -go -wait
   wiki    5000 app  /home/app  log/wiki   ./pil wiki/main.l lib/app.l -main 
wiki/_patch.l -go -wait
   sushi  22000 app  /home/app  log/sushi  ./pil sushi/main.l lib/app.l -main 
-go -wait
   menu   24000 app  /home/app  log/menu   ./pil menu/main.l lib/app.l -main 
-go -wait
   canvas 27002 app  /home/app  log/canvas ./pil misc/canvas.l lib/app.l -main 
app/_patch.l -go -wait
   phone  27003 app  /home/app  log/phone  ./pil misc/phone.l lib/app.l -main 
app/_patch.l -go -wait
   osm    27004 app  /home/app  log/osm    ./pil osm/main.l lib/app.l -main 
app/_patch.l -go -wait

i.e. the arguments, separated by spaces, are:

   1. The name of the application
   2. The port where this server should listen at
   3. The user name
   4. The working directory of the server process
   5. The log file where stdout and stderr should be redirected to
   6. The command line to start the server process

(For optimal access if you have really many servers, you should
'balance' the contents of the config file. That's left as a task to the

When a client requests e.g.


this server will be started. That is, the name 'canvas' is looked up,
and 'httpGate' checks if a process is listening at 27002. If not, it
starts that process.

The 'go' function of the server (see the example in "app/main.l") may

   (retire 20)

This will cause this server to stop if there are no child processes and
no activities for 20 minutes.

'httpGate' sends the NAME of the application under which it was invoked,
and the PORT it should listen at, in environment variables. Thus, the
'server' call is

   (server (or (format (sys "PORT")) 8080) "!work") )

It uses the PORT passed in, or defaults to 8080.

In that way you may have thousands of client application running on a
single machine, each one only started and stopped as necessary.

♪♫ Alex
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to