lonc - LON TCP-MySQL-Server Daemon for handling database requests.
Usage: lonc
Should only be run as user=www. This is a command-line script which is invoked by loncron. There is no expectation that a typical user will manually start lonc from the command-line. (In other words, DO NOT START lonc YOURSELF.)
Provides persistent TCP connections to the other servers in the network through multiplexed domain sockets
lonc forks off children processes that correspond to the other servers in the network. Management of these processes can be done at the parent process level or the child process level.
After forking off the children, B<lonc> the B<parent> executes a main loop which simply waits for processes to exit. As a process exits, a new process managing a link to the same peer as the exiting process is created.
logs/lonc.log is the location of log messages.
The process management is now explained in terms of linux shell commands, subroutines internal to this code, and signal assignments:
This is the process id number of the parent lonc process.
Parent signal assignment: $SIG{INT} = $SIG{TERM} = \&HUNTSMAN;
Child signal assignment: $SIG{INT} = 'DEFAULT'; (and SIGTERM is DEFAULT also) (The child dies and a SIGALRM is sent to parent, awaking parent from slumber to restart a new child.)
Command-line invocations: kill -s SIGTERM PID kill -s SIGINT PID
Subroutine HUNTSMAN: This is only invoked for the lonc parent PID. This kills all the children, and then the parent. The lonc.pid file is cleared.
Current bug: This signal can only be processed the first time on the parent process. Subsequent SIGHUP signals have no effect.
Parent signal assignment: $SIG{HUP} = \&HUPSMAN;
Child signal assignment: none (nothing happens)
Command-line invocations: kill -s SIGHUP PID
Subroutine HUPSMAN: This is only invoked for the lonc parent PID, This kills all the children, and then the parent. The lonc.pid file is cleared.
Parent signal assignment: $SIG{USR1} = \&USRMAN;
Child signal assignment: $SIG{USR1}= \&logstatus;
Command-line invocations: kill -s SIGUSR1 PID
Subroutine USRMAN: When invoked for the lonc parent PID, SIGUSR1 is sent to all the children, and the status of each connection is logged.
POSIX IO::Socket IO::Select IO::File Socket Fcntl Tie::RefHash Crypt::IDEA
linux
Server/Process