Starting K2 Server

The ColdFusion installer places the K2 files into the following directories:

The K2 Server is started from the command line or from a script in the Unix environment and can be integrated as a service within the Windows NT environment. The server is designed to run with a minimum of intervention. Most configuration parameters are set in a configuration file, which can be given a user-assigned name (the default file name is k2server.ini).

Command-line arguments include the name of the configuration file, the TCP port for incoming connections and the verbosity level for informational messages. The K2 Server has a warm restart capability, designed to keep the server's well-known TCP port open in case of a crash and to allow changes in the configuration file to be initialized without killing the primary server process.

The K2 Server is started by the using the following command:

k2server [<option1> <option2> ...]

The options available for this command are summarized in the following table:

Keyword
Permitted values
Function
-port <value>
Positive integer
Identifies the TCP port number for use by the K2 Acceptor. To run the K2 Server as an NT service, use the -ntservice keyword and do not specify a port number using the -port keyword.
-iniFile <filename>
Any valid filename
Identifies the filename to use as theconfiguration file for this instance of the K2 Server.
-verbose <value>
0 = status
1 = informational
2 = verbose
3 = debug
Determines the amount of information contained in the K2 Server system messages.
-iniEmit <filename>
Any valid filename
Creates a sample configuration file.
-ntService <value>
1 = load as NT service
0 = remove as NT service
Used to load or remove the K2 Server as an NT service. When set to 1, the server is loaded as an NT service. When set to 0, the server is removed as an NT service.
Note: To run the K2 Server as an NT service, do not specify a port number using the -port keyword.
Not applicable to non-Windows platforms.

Windows batch file example

The Windows batch file installed as cfusion\bin\startk2server.bat looks like this:

set K2_MODE=SEARCH

k2server -inifile k2server.ini

To start K2 Server, open a command window and execute the batch file.

Running K2 Server as a Windows service

When you use the -ntservice 1 option, K2 Server runs as a Service in Windows. As a service, you can specify startup parameters for K2 Server so that it starts automatically at boot time.

Linux and UNIX scripts

On UNIX platforms, two scripts have been provided you can use to start and stop K2 Server. They are startk2server and stopk2server, both installed into the opt/coldfusion/bin directory.

UNIX/Linux startk2server script file listing

#!/bin/sh

#

platform=`uname`

case $platform in

  SunOS)

    echo "SunOS"

    platform=_ssol26

    LD_LIBRARY_PATH=/opt/coldfusion/verity/${platform}/bin

    ;;

  HP-UX)

    echo "HP-UX"

    platform=_hpux11

    SHLIB_PATH=/opt/coldfusion/verity/${platform}/bin

    ;;

  Linux)

    echo "Linux"

    platform=_ilnx21

    LD_LIBRARY_PATH=/opt/coldfusion/verity/${platform}/bin

    ;;

esac

K2_MODE=SEARCH

export K2_MODE

  INIFILE=/opt/coldfusion/verity/${platform}/bin/k2server.ini

  /opt/coldfusion/verity/${platform}/bin/k2server -iniFile 

  $INIFILE



exit 0



Banner.Novgorod.Ru