Command line flags.

The Connection Manager has command line flags to either enable it to be used from an command shell or script or alter behaviour when running as the Connection Manager. These command line flags are mainly to used to testing and conversion purposes.


Synopsis

Execute all startup scripts

kwebserv -i arg1 ... argN
Execute startup script for a specific service
kwebserv -s ServiceName -i arg1 ... argN
Examine a configuration file
kwebserv -e ConfigFile
Execute a specific script using a service's environment
kwebserv -s ServiceName -p script
Load balancing
kwebserv -w maxLoad:minLoad:delay:retries


Command line options

FlagsContextPurpose
-c envfileCommand shellConvert a text-format environment file to an XML document
-e configFileCommand shellExamine a configuration file
-g hostnameinetd configEnable SPNEGO SSO authentication. The hostname is the FQDN name of the server principal.
-G hostnameinetd configLike -g but force the use of Kerberos only.
-iUnix boot script or command shellInitialize services
-k pathmameinetd config or command shellUse alternative configuration file instead of $KCMLDIR/kconf.xml
-p scriptCommand shellExecute a shell script using a service's environment.
-rinetd configRestricted mode. Disable programmability and access to the interactive console shell by setting NOPROG=true and PSEUDOTTY=false
-s serviceCommand shell or Unix boot scriptTest a service from a telnet session (Unix only).
Also used in conjunction with the -i flag to execute a startup script for the specified service.
-t timeoutinetd configSet the login timeout. Default is 30 seconds.
-w thresholdinetd configDefer execution until system load is below a threshold
-x SSLCertinetd configUse SSL certificate SSLCert to enable Secure Connection mode
-z inetd configAIX5.2 builds only. Used in conjuction with the -x SSLCert option. Force the dynamic loader to use the OpenSSL 0.9.7 libraries from /opt/freeware/lib

Converting Environment files.

Applications may define their environment in a plain text file. This has the following format:

[UNB]"VAR","value"

The first character of a line in this file determines what platform the variable applies to.

It can take the following values.

CharacterMeaning
USet variable on Unix platforms only
NSet variable on Windows platforms only
BSet variable on both types of platforms

These files can be loaded by the Connection Manager by using the get_include or try_include directives. Alternatively, this text format file can be converted to an XML document by using the -c flag, and the loaded using the include directive.

Converting Applications to run under the Connection Manager.

Applications which use telnet connections and define their environment in shell scripts can be adapted for the the Connection Manager. The current environment can be dumped into a text file using the set command:

set >myenv.txt

This can then be conveted into the above text file format by using commands such as sed, although some editing with vi will be necessary to recreate variables which are based on other variables, i.e.

B"BASE","/user1/myapp"
B"HOME","/user1/myapp/home"

Should be changed to

B"BASE","/user1/myapp"
B"HOME","$BASE/home"

As mentioned above the resulting file can either be loaded by the get_include or try_include directives, or it can be converted to XML and loaded using the include directive.

Prior to using the Connection Manager directly, ie via network port 790, the application can be tested, from a telnet session, by using the -s flag, Eg:

$ export PATH=$PATH:/usr/local/kcml:.
$ export KCML_SOURCES=/usr/local/kcml/kconf.xml
$ kwebserv -s MyApp

The Connection Manager will load the environment variables, from kconf.xml and any included files, and then execute kcml. If the environment has been setup correctly, including the START variable, the the application should function correctly. Once this has been confirmed, client PC's should connected directly to the Connection Manager by adding the service name to the Connect to Service field in the properties of a KClient connection.


Executing scripts under a service's environment.

A shell script can be executed under the Connection Manager by using the -p flag. When used in conjunction with the -s servicename flag, the script will inherit the service's environment settings.

kwebserv -s myApp -p script.ksh


Initializing a service.

When the host server is started, it may be desirable for any application background processes to be started automatically, for example a global library process. These processes will require the same environment as the application. Attempting to write shell scripts to parse kconf.xml and any other evnironment files would not be trivial. To simplify this process, the Connection Manager can automate this by using the -i flag and the service's Startup Script property. For more details see ASP support.


Checking the kconf.xml Configuration file

If the Connection Manager fails to start one cause can be a corrupt kconf.xml configuration file. The configuration file can be examined with the -e flag

kwebserv -e kconf.xml

Kwebserv will parse the file and, if it is valid XML, will list the top level access control lists, e.g.:

kwebserv: kconf.xml is valid XML
validclients: localhost 11.22.33.* 44.55.66.*
validusers: root kcc* fred alf bert
adminusers: root sysadmin kcc*

If the file contains a syntax error, then the line number and reason on which the error occurred will be reported, e.g.:

Corrupt configuration file kconf.bad: XML parser failed with "mismatched tag" on line 15

When the -e flag is used in conjunction with the -s serviceName flag, the service's access control lists, database catalogue, alias and table space lists will be displayed.

For example, the command:

kwebserv -s SalesSystem -e kconf.xml

may display something of the form:

kwebserv.exe: kconf.xml is valid XML
validclients: 11.22.33.* localhost
validusers: fred joe kcc*
adminusers: kcc*
KDB catalogue /user1/myapp/data/catalogue.kdb OK
Tablespace       status           location
GLOBAL           OK               /user1/myapp/data/GLOBAL
MISC             OK               /user1/myapp/data/MISC
ACCOUNTS         OK               /user1/myapp/data/ACCOUNTS
STOCK            OK               /user1/myapp/data/STOCK
WORKSPACE        OK               /user1/myapp/work
Alias            status           location
KPrintForms      OK               /user1/myapp/sw/Docs/KPrintForms
Docs             OK               /user1/myapp/sw/Docs
Reports          OK               /user1/myapp/misc/Reports
UserReports      Does not exist   /user1/myapp/misc/UserReports
Help             OK               /user1/myapp/sw/Docs/Help
CGI              OK               /user1/myapp/sw/Docs/CGI
Return values for kwebserv -e
ValueDescription
0Success. kconf.xml is valid XML. If -s service is also used then the DB catalogue, table spaces and aliases exist.
1Failed to open or parse kconf.xml, or an environment <include> file.
2Database catalogue does not exist
3One or more table spaces does not exist
4One or more aliases does not exist

When making manual changes to kconf.xml in an existing system it is recommended that a copy is made. The new copy can then be edited and then checked with the -e flag before it is copied back. E.g.:

cd /usr/local/kcml
cp kconf.xml kconf.new
vi kconf.new
kwebserv -e kconf.new

Balancing system load

When a server is heavily loaded, the -w switch can be used to defer execution of kcml. The flag has a parameter string which has the format maxLoad:minLoad:delay:maxRetry. The maxLoad and minLoad values are CPU loads, not the run queue lengths that are reported by uptime(1). If the load on the server is above maxLoad, then the Connection Manager will wait delay seconds until the system load drops below minLoad. If the system load has not dropped below minLoad after maxRetry attempts then it will report the error and exit.

The -w switch is added to system /etc/inetd.conf or /etc/xinetd.d/KCC configuration files, for example:

server_args     = /usr/local/kcml/kwebserv -w 0.85:0.5:1:20

If the load is above 85%, retry 20 times until the load is below 50%, waiting 1 second between each attempt.

The -w switch is supported on AIX5.3, Linux 2.6, Solaris 10, and Windows XP or later.

If the argument for the -w switch contains an invalid value, then default values will be used instead:

maxLoad0.9
minLoad0.6
delay2
maxRetry10
See Also:

Connection Manager Remote Adminstration Functions