[Date Prev][Date Next] [Chronological] [Thread] [Top]

To put slapd in inittab


I made some little changes to file "main.c" of slapd
and to file "detach.c" of liblutil to allow slapd 
to be put in inittab and thus to be run by init.
Usually slapd exits after it started three children,
so init notices the death of the parent and attempts
to restart it. I simply added a command-line option 
that sets a life-time for slapd. This value is passed 
as a negative number to 

    lutil_detach ( -sleep_time, 0 ) ;

instead of ldap_debug, if not in debug mode.
On turn, lutil_detach, when passed a negative 
debug number, calls a 

    sleep ( -debug ) ;

before the

    _exit ( 0 ) ;

that is performed after the parent forked.
The initial condition must be changed in 

    if ( debug <= 0 ) {

In this way, the daemon lives for sleep_time
seconds, that can be arbitrarily long.

My questions are: is there any good reason 
to make the parent process die, and: if any,
is my change altering the correct behaviour
of the slapd daemon?

Thanks in advance for replies, and hope this 
little change can help somehow.

Pierangelo Masarati