GNU Dico Manual (split by node):   Section:   Chapter:FastBack: Dicod   Up: Dicod   FastForward: Modules   Contents: Table of ContentsIndex: Concept Index

4.1 Daemon Operation Mode

The ‘daemon’ mode is enabled by mode daemon statement in the configuration file (see mode statement). It is also the default mode. In daemon mode dicod listens for incoming requests on one or several network interfaces. Unless the --foreground option is specified, it detaches itself from the controlling terminal and switches to background (becomes a daemon). When an incoming connection arrives, it forks a subprocess for handling it.

In this mode the following signals cause dicod to terminate: ‘SIGTERM’, ‘SIGQUIT’, and ‘SIGINT’. The ‘SIGHUP’ signal causes the program to restart. This works only if both the program name and its configuration file name (if given using --config option) are absolute file names.

Upon receiving ‘SIGHUP’, dicod first verifies if the configuration file does not contain fatal errors. To do that, the program executes a copy of itself with the --lint option (see --lint) and analyzes its return code. Only if this check passes, dicod restarts itself. This ensures that the daemon will not terminate due to unnoticed errors in its configuration file.

Upon receiving ‘SIGTERM’, ‘SIGQUIT’, or ‘SIGINT’, the program stops accepting incoming requests and sends the ‘SIGTERM’ signal to all active subprocesses. Then it waits a predefined amount of time for all processes to terminate (see shutdown-timeout). Any subprocesses that do not terminate after this time are sent the ‘SIGKILL’ signal. Then, the database modules are unloaded and dicod terminates.

Several command line options are provided that modify the behavior of dicod in this mode. These options are mainly designed for debugging and error-hunting purposes.

The --foreground option instructs the server to remain attached to the controlling terminal and stay in the foreground. It is often used with --stderr option, which instructs dicod to output all diagnostic to the standard error output, instead of syslog which is used by default.

GNU Dico Manual (split by node):   Section:   Chapter:FastBack: Dicod   Up: Dicod   FastForward: Modules   Contents: Table of ContentsIndex: Concept Index