Running the Aceserver

Running the Aceserver


The syntax is:

    aceserver database_path -port decimal_port_number -time_out client_time_out_in_seconds -server_time_out server_time_out_in_seconds -maxKbytes max_chunk_size_in_KB
If you rename or link aceserver to rpc.acedbd then you can use the following syntax:

    rpc.acedbd database_path decimal_port_number client_time_out_in_seconds:server_time_out_in_seconds:max_chunk_size_in_KB
Note the colons separating the last three parameters. Time outs of 0 for the client/server will disable time outs for the client/server. A chunk size of 0 turns off chunking on the server side. It is still possible to set chunk size on the client side. See below for how to run the aceserver as daemon from inetd.

Using perl output from the server

Using the perl output option requires that the output be modified to include a delimiter. The reason for this that things like quotes in the data will confuse perl when it trys to read perl objects from acedb. The default delimiter is ^A (control-A, 0x01). If the ACEQM variable is set upon server startup then its value, which may consist of multiple characters, will be used instead of ^A. Perl clients should use the character as a delimiter to protect single quotes.

Example code here on how to handle this on the client side:

# protect single quotes in aceserver output
$ace_output =~ s/\'/\'.\"\'\".\'/g;   # ^Acan't^A           ----> ^Acan' . "'" . 't^A
# converts ^A (or $separator) to single quotes
$ace_output =~ s/$separator/\'/g;     # ^Acan' . "'" . 't^A ----> 'can' . '"' . 't'
# builds the perl ace object
$obj = eval($ace_output);             # 'can' . "'" . 't'   ----> can't
Examples of perl ace objects and how to manipulate them will be available at NAL.

Installing aceserver to run as inetd daemon

  1. Create a user account for the user that will run the program

  2. To turn the aceserver into a daemon program either copy aceserver to rpc.acedbd or (better) make a link e.g ln -s /usr/local/bin/aceserver /usr/local/bin/rpc.acedbd (or whereever you want to keep it). The user created in step 1. must have execute permission on the rpc.acedbd.

  3. Select the RPC program number (RPCPN) for your server. This should be a decimal number that is not in use on your system. If you want to run multiple servers (multiple databases), reserve a number for each. Registered numbers should be in /etc/rpc.

  4. Edit /etc/rpc (or get your system administrator to do it). Add a and for each server. See man5 rpc for more info on the file format.

    Examples:
       acedb    20000114
       aboutdb  20000115
       aatdb    20000116
    
  5. Edit /etc/inetd.conf (or get your system administrator to do it) and add a line for each server.

    The format is:

        <databasename>/<version> stream rpc/tcp wait <user> <path> rpc.acedbd <DB_path> <port> <cto>:<sto>:<mKB>
    
    Where:
        <databasename> is the same one as was entered in /etc/rpc
        <version> currently 1
        <user> the username created in step 1
        <path> the full path to the executable (or to the link)
        <DB_path> the full path to the database
        <port> the same port as was entered in /etc/rpc
        <cto> Client timeout. Time that a connection with an inactive  client is kept open
        <sto> Server timeout. Time that the server stays alive, when no client connections are active
        <mKB> Maximum chunk size in KB
    
    Examples:
        acedb/1 stream  rpc/tcp wait root /usr/local/bin/rpc.acedbd rpc.acedbd /acedb/worm 20000114 600:600:100
        aboutdb/1 stream  rpc/tcp wait root /usr/local/bin/rpc.acedbd rpc.acedbd /acedb/aboutdb 20000115 600:600:10
        aatdb/1 stream  rpc/tcp wait root /usr/local/bin/rpc.acedbd rpc.acedbd /acedb/aatdb 20000116 600:600:50
    
  6. Restart inetd (or get your system administrator to do it) by sending HANGUP signal to it, e.g. 'kill -HUP ' where PID is the process id of inetd.

    If an aceclient is started to connect to your server machine with a port from the one's you created, the corresponding server will be started, and stay alive as long as there are active clients. If all clients are disconnected and the server timeout has elapsed, the server will shut itself down. A timeout =3D 0 (as set on the command line) will prevent shutdown (but this is not advisable). The default timeout is 600 seconds.