Technical description of the racnucd daemon

Program racnucd manages all remote access to ACNUC databases. It is a daemon process that forks a child process for each remote client that opens a socket connection. The 3 actors, daemon, child process, and remote client, and programs that temporarily disable databases for updates, communicate through socket, signals and named pipes as follows :

       __________________________________________________________________________________________
       |                                                                                         |
       |          configuration                                                                  |      
       |              file                                                                       |    
       |                                                                                         | 
       |             daemon    <--------------  db management programs                           |         
       |                         disable_pipe                                                    |  
       |             ^   |                                                                       | 
       |             |   |                                                                       | 
       |    open_pipe|   |signals                                                                | 
       |             |   |SIGUSR1 & SIGUSR2                                                      |        
       |             |   |                                                                       |                    
       |             |  \/                                                                       | 
       |                           socket (default = pbil.univ-lyon1.fr:5558)                    |       
       |             child        <==========================================>     remote client |
       __________________________________________________________________________________________

daemon: Deamon uses a series of configuration parameters: port, maxtime, pas_temps, known_db_file, db_env_names, disable_pipe, open_pipe. The first argument given at daemon startup names the configuration file.

signals:Signal SIGUSR1 is sent to all children by daemon every pas_temps seconds, the child exits if it did not communicate with its client for more than maxtime seconds.
Signal SIGUSR2 is sent to child by daemon when the database currently served by this child to its remote client has just been temporarily closed for update; the child writes "acnuc stop for update\n" on socket and exits.

configuration file: is read by daemon at startup; is structured such as this:
port=5558
maxtime=50000
pas_temps=6000
known_db_file=/www/data/banques_raa
db_env_names=/www/data/banques_acnuc
disable_pipe=racnucd_disable.fifo
open_pipe=racnucd_open.fifo

parameter open_pipe: a named pipe, writable by the daemon-running user, named by open_pipe configuration parameter. Child writes "acnucopen dbname pid\n" or "acnucclose dbname pid\n" on it to inform daemon of what child serves what database (dbname is the database name, pid is the child's).

parameter disable_pipe: a named pipe, writable by the db management user, named by disable_pipe configuration parameter. A database management program that intends to update a database writes on it "disable dbname\n" or "enable dbname\n" to inform daemon that a given database becomes temporarily closed, or is back on line. Daemon then sends SIGUSR2 to any child serving this database.

parameter known_db_file: names the file that lists the name and availability of databases that the daemon offers to serve. An example file is:

# db_name | current status | tag | description
#         |   on / off     |     | free text
genbank   | on             |     | GenBank
embl      | on             |     | EMBL sequence data library
swissprot | off            |     | SwissProt + TREMBL + TREMBLnew  
emblTP    | on             | TP  | frozen EMBL release  
Each db_name is a logical name for a database; see parameter db_env_names.
Databases with empty tag field are listed by the knowndbs command; those with a non-empty tag field can be listed only with the knowndbs&tag=tagname command. Any of these databases can be opened by the acnucopen&db=db_name command.
Changes in this file are immediately accessible to the server.

parameter db_env_names: names the file that gives values to database names listed in known_db_file, following the csh syntax. The values express where are located index and flat files of the corresponding databases. Changes in this file are immediately accessible to the server. An example file is:

#file defining the location of all acnuc databases
setenv embl '/banques1/embl/index /banques3/embl/flat_files'
setenv genbank '/banques0/genbank/index /banques0/genbank/flat_files' 
setenv swissprot '/banques3/swissprot/index /banques3/swissprot/flat_files' 

parameter port: sets the port used for socket communication.

parameter pas_temps: Deamon runs an alarm each pas_temps seconds that makes it send signal SIGUSR1 to all its children.

parameter maxtime: time limit for lack of communication between client and child.

db_management programs: use the utility program raadbstatus to send disable/enable information to daemon.