minetd configuration

1. the parser

The parser reads a linear sequence of commands. Most commands update properties of a global internal state. The special command "create" takes the current global state and creates a service.

Command syntax is key=value. Commands are coming from a file (one command per line) or from a command line argument (-c key=value).

2. commands

The actual commands are documented in design.txt for now.

Command create takes the current global state and sets up a service; the name (ID) of the service is the value of the command. As a side effect cmd and arg are deleted from the global state - this means they have to be specified before each create.

3. examples

3.1. echo service

Create a process that listens on localhost:4242 and echoes anything written to it. Allow only one instance in parallel.
protocol=tcp
bind=127.0.0.1
port=4242
cmd=/bin/cat
instances=1
create=kitty

3.2. echo service - IP filtering

Create a process that listens on 4242 and echoes anything written to it. Allow three instances in parallel, accept clients from 127.0.0.1 only.
protocol=tcp
allow_ip=127.0.0.1
policy=deny
bind=0.0.0.0
port=4242
cmd=/bin/cat
instances=3
create=kitty

3.3. redirect monitoring messages to file

Make minetd copy all monitoring messages to the stdin of a process that then saves them to a file. This is achieved by setting the protocol to monitor, which is a virtual service. Monitoring messages also end up on stdout as normally.
protocol=monitor
cmd=sh
arg=-c [cat > LOG1]
create=dup_my_mon

3.4. shell wrapper

Minetd doesn't try to switch user or set ulimit for the process. The policy is that minetd concentrates on networking and everything else is up to the user. The recommended approach is wrapping the service in a shell script that sets up the environment. This obviously can be achieved using an shell script file that is then specified in the cmd command, but also can be done "in-line". The following example demonstrates how to specify a short shell script in the config. The change the script does in the environment affects CWD. Note how [] is used to protect words in arg.
protocol=tcp
bind=127.0.0.1
port=4244
cmd=sh
arg=-c [cd /tmp && ls && sleep 1 && ls -l]
create=wrapper