The finished application has the following
invocation syntax (by way of statserv_main()):
application [-install] [-installa] [-remove] [-a ] [file-v ] [level-l ] [file-u ] [uid-c ] [config-f ] [vconfig-C ] [fname-t ] [minutes-R ] [seconds-N ] [children-M ] [terms-k ] [kilobytes-K] [-d ] [daemon-w ] [dir-p ] [pidfile-r ] [kilobytes-ziDSTV1] [listener-spec...]
The options are:
-a
file
Specify a file for dumping PDUs (for diagnostic purposes).
The special name - (dash) sends output to
stderr.
-SDon't fork or make threads on connection requests. This is good for debugging, but not recommended for real operation: Although the server is asynchronous and non-blocking, it can be nice to keep a software malfunction (okay then, a crash) from affecting all current users.
-1
Like -S but after one session the server
exits. This mode is for debugging only.
-TOperate the server in threaded mode. The server creates a thread for each connection rather than fork a process. Only available on UNIX systems that offer POSIX threads.
-sUse the SR protocol (obsolete).
-z
Use the Z39.50 protocol (default). This option and -s
complement each other.
You can use both multiple times on the same command
line, between listener-specifications (see below). This way, you
can set up the server to listen for connections in both protocols
concurrently, on different local ports.
-l fileThe logfile.
-c configA user option that serves as a specifier for some
sort of configuration, usually a filename.
The argument to this option is transferred to member
configname of the
statserv_options_block.
-f vconfigThis specifies an XML file that describes one or more YAZ frontend virtual servers.
-C fname
Specifies the PEM-encoded certificate chain and private key presented
by the server for SSL connections. If the certificate chain and private
key are stored in the same file, specify
certificate-file. If they are stored in
separate files, specify
certificate-file,key-file.
If this option is not specified, a server operating in SSL mode uses
yaz.pem as the default certificate and private key
file.
-v levelThe log level. Use a comma-separated list of members of the set {fatal,debug,warn,log,malloc,all,none}.
-u uidSet the server's supplementary groups, primary group ID, and user ID to those of the given account. This normally requires starting as root, for example to bind a privileged port before dropping privileges. Failure to resolve the account or change any part of its identity prevents server startup.
-w dir
The server changes to this directory before listening
to incoming connections. This option is useful
when the server is operating from the inetd
daemon (see -i).
-p pidfile
Specifies that the server should write its Process ID to the
file given by pidfile.
A typical location would be /var/run/yaz-ztest.pid.
-iUse this to make the the server run from the inetd server (UNIX only).
-D
Use this to make the server put itself in the background and
run as a daemon. If neither -i nor
-D is given, the server starts in the foreground.
-installUse this to install the server as an NT service (Windows NT/2000/XP only). Control the server by going to the Services in the Control Panel.
-installaUse this to install the server as an NT service and mark it as "auto-start. Control the server by going to the Services in the Control Panel.
-removeUse this to remove the server from the NT services (Windows NT/2000/XP only).
-t minutes
Idle session timeout, in minutes (or seconds with an s
suffix). This is separate from the request completion deadline.
-R secondsMaximum time to complete a request or the initial TLS handshake, in seconds. Default is 60. The initial deadline starts when the association is created; subsequent request deadlines start on the first incomplete read. Receiving more bytes does not extend the deadline. An expired deadline closes the connection. The value must be positive.
-N childrenMaximum number of live session children in UNIX fork mode. Default is 100. Connections accepted at the limit are closed without forking. Exited children release their slots. The value must be positive. This option does not limit threaded, single-process, or inetd mode.
-M termsMaximum number of terms requested in an SRU or Z39.50 scan. Default is 1000. Larger requests receive a "too many terms requested" diagnostic before scan entries are allocated or the scan handler is called. The value must be positive. An SRU request without maximumTerms defaults to 10 terms, or this limit if it is smaller than 10.
-k sizeMaximum record size/message size, in kilobytes.
-KForces no-keepalive for HTTP sessions. By default GFS will keep sessions alive for HTTP 1.1 sessions (as defined by the standard). Using this option will force GFS to close the connection for each operation.
-r sizeMaximum size of log file before rotation occurs, in kilobytes. Default size is 1048576 k (=1 GB).
-d daemon
Set name of daemon to be used in hosts access file. See hosts_access(5) and tcpd(8).
-m time-format
Sets the format of time-stamps in the log-file. Specify a string in
the input format to strftime().
-V Display YAZ version and exit.
A listener specification consists of a transport mode followed by a
colon (:) followed by a listener address. The transport mode is
either tcp, unix: or
ssl.
For TCP and SSL, an address has the form
hostname | IP-number [: portnumber]
The port number defaults to 210 (standard Z39.50 port).
For UNIX, the address is the filename of socket.
For TCP/IP and SSL, the special hostnames @,
maps to IN6ADDR_ANY_INIT with
IPV4 binding as well (bindv6only=0),
The special hostname @4 binds to
INADDR_ANY (IPV4 only listener).
The special hostname @6 binds to
IN6ADDR_ANY_INIT with bindv6only=1 (IPV6 only listener).
Example 4.1. Running the GFS on Unix
Assuming the server application appname is
started as root, the following will make it listen on port 210.
The server will change identity to nobody
and write its log to /var/log/app.log.
application -l /var/log/app.log -u nobody tcp:@:210
The server will accept Z39.50 requests and offer SRU service on port 210.
Example 4.2. Setting up Apache as SRU Frontend
If you use Apache
as your public web server and want to offer HTTP port 80
access to the YAZ server on 210, you can use the
ProxyPass
directive.
If you have virtual host
srw.mydomain you can use the following directives
in Apache's httpd.conf:
<VirtualHost *>
ErrorLog /home/srw/logs/error_log
TransferLog /home/srw/logs/access_log
ProxyPass / http://srw.mydomain:210/
</VirtualHost>
The above is for the Apache 1.3 series.
Example 4.3. Running a server with local access only
A server that is only being accessed from the local host should listen
on UNIX file socket rather than an Internet socket. To listen on
/tmp/mysocket start the server as follows:
application unix:/tmp/mysocket