Pax Runner (since 0.20.0) supports running as a detached process out of the box. This means that Pax Runner can start up as a process that can run in the background and will not require the console to keep it running. This support can be used to make it run as a daemon (in Unix based systems) or as a Windows service (in Windows systems) with little effort.

Starting up

Use the following command to start Pax Runner as a detached process:

pax-rund --startd

NB: startd signifies startdaemon or startdetached.

To run the Pax Runner as an attached process, you can use the following command:

pax-rund --start

In case you are using Java 1.4, you can replace pax-rund above with pax-rund-1.4.

The commands above will start up Pax Runner with default options and with no provisioning, but with an option to stop the Pax Runner remotely.

If you are running either of the commands for the first time, you will be prompted to enter a password for the configuration. This password will be required to stop the Pax Runner from a remote location. A configuration for daemon is maintained for every user.

Stopping

Once the Pax Runner is started using the pax-rund scripts, you can stop the Pax Runner in various ways.

Stopping using remote telnet

You can stop the Daemonised Pax Runner by a connecting to the instance using a telnet client and issuing a shutdown command. By default the Pax Runner Daemon will accept telnet connection at port 8008. The telnet screen will look similar to this:

>telnet 192.168.1.3 8008
Trying 192.168.1.3...
Connected to 192.168.1.3.
Escape character is '^]'.
====================================
Welcome to Pax-Runner Remote Console
====================================
Please enter password:

You will have to supply the password set for the configuration to log in and provide shutdown command. The Pax Runner Daemon instance will stop only on the correct shutdown command. The default shutdown command is shutdown.

You can choose to stop the Pax Runner Daemon after a specified amount of time by specifying the milliseconds after the shutdown command, after which the shutdown sequence will begin. By default (not specifying anything) the shudown sequence will begin immediately.

Stopping using local telnet

If you connect to the Daemonised Pax Runner by a connecting to the instance using a telnet client from the same machine itself. In this case however, no password will be prompted, but you will have to still provide the correct shutdown command.

Enter the command to shutdown the Pax Runner:
> shutdown
Connection closed by foreign host.

Stopping using scripts

You can stop the Pax Runner Daemon instance running on the same machine using scripts using the following command:

pax-rund --stop

Stopping this way using scripts will not prompt you for a password or a shutdown command.

Stopping other ways

The Daemon will stop if the Pax Runner itself stops - either due to some errors, or if the OSGi platform was shutdown, and additionally in the attached mode by applying control signals (such as Ctrl+C) that will stop the JVM.

Providing options and parameters

The Daemon accepts the all the Pax Runner options and parameters and additionally accepts the following options:

Option Key

Description

org.ops4j.pax.runner.daemon.network.timeout

The time for which the telnet connection should be valid. After the specified amount of milliseconds, the telnet connection will be disconnected. The default time is 1 minute. Specifying 0 will mean an infinite amount and is not recommended.

org.ops4j.pax.runner.daemon.shutdown.timeout

The time (in ms) after which the shutdown sequence will begin. The default value is 0. You can always override this value by specifying the timeout after the shutdown command.

org.ops4j.pax.runner.daemon.shutdown.cmd

The command that will be accepted as the valid shutdown command. The default value is shutdown.

org.ops4j.pax.runner.daemon.shutdown.port

The port on which the Pax Runner Daemon will listen to telnet connections and shutdown commands. The default port is 8008.

For example, to start Pax Runner as a detached process with a custom shutdown port:

pax-rund --startd --org.ops4j.pax.runner.daemon.shutdown.port=9009

Starting and stopping Pax Runner Daemon with the Operating System

The Pax Runner Daemon can be easily integrated with OS startup and shutdown sequence (effectively as a daemon/service in the real sense) with very little effort.

(warning) TODO.