NetPhantom Service Wrapper

Introduction

As part of the NetPhantom server suit, a service wrapper is now included. The service wrapper makes it possible to run several programs as a single Windows NT Service. This makes it possible to for example run the NetPhantom License manager and a NetPhantom server as sub-processes in a single Windows NT Service.

This service wrapper can also be run as a normal command line program, and will then work more as a process wrapper, that handles several sub processes. This makes it possible to use it in UNIX/Linux environment to handle several processes.

The service/process wrapper uses a configuration file that makes it possible to specify the startup command line for each sub process, and different command lines for each return code from the process when it is closing.


Running the Service Wrapper

The program that installs, or uninstalls, the Service Wrapper, is the NetPhantomWindowsNTService executable.

In the NetPhantom installation root directory, run the command below as an administrator:

    NetPhantomWindowsNTService parameters

This program can take the following parameters:

/INSTALL Register service(s) with Windows NT.
/UNINSTALL Unregister service(s) from Windows NT.

Running the Process Wrapper

The Process Wrapper is started from the command line as a normal application, running under Sun's JVM, with the following command:

    java [-options [-Xrs]] windowsnt.NetPhantomService [-params]

where -options [-Xrs] are the normal options for Sun's JVM.

and where -params are the following parameters, that can be passed on to the NetPhantomService.

  • -ntservice
    Causes the process to run with less Operating System signals, typically when running from e.g. Sun Java as a generic Windows service.
     
  • -nteventlog
    Causes all events logged on the standard output to be logged in the Windows Event Log

The Configuration File

The configuration file that is used by the service wrapper is named service.ini. It consists of several sections, first a base section, and then a separate section for each process.

The base section must at least have item that specifies the number of processes that the service wrapper should handle. This item is named processcount. There is also an optional item named originator, that can be used to specify the name that will be used as the source in the Windows Event Log. If the originator is unspecified, the default "NetPhantom Service" will be used.

    [base]
    processcount=1
    originator=MyNetPhantomService

For each process there must be a section named processNNN where NNN is the number of the process.

The sections must at least have an item named cmdline, but there are also several optional items that can be used. The items that can be used for each process section are:

  • cmdline
  • rc(n)
  • logmessage(n)

Below follows a short description of these items.

cmdline=cmd
cmd This is the command line to start the process.

rc(n)=cmd
n The exit code.
cmd This is the command line to be executed after the sub process has exited with the specified exit code. If cmd is specified as close, then no further action will take place on this process.

logmessage(n)=cmd
n The exit code.
cmd This is the text that will be written to the logfile, instead of the default message, that is Restarting process nn - cmdline: cmd, where nn is the process number and cmd is the command line.