ceec7ba Bug 668385 - DS pipe log script is executed as many times as the dirsrv service is restarted

Authored and Committed by rmeggins 13 years ago
    Bug 668385 - DS pipe log script is executed as many times as the dirsrv service is restarted
    
    https://bugzilla.redhat.com/show_bug.cgi?id=668385
    Resolves: bug 668385
    Bug Description: DS pipe log script is executed as many times as the dirsrv service is restarted
    Reviewed by: nkinder (Thanks!)
    Branch: 389-ds-base-1.2.8
    Fix Description: The main thing was adding a pid file for the script itself,
    so it can know if it is running or not.  This is the new '-i' argument.
    The other tricky part was figuring out, when reading the pipe, it is hard to
    know if the server has really exited or not, and therefore, if the script
    can exit.  When the server is starting up, when it daemonizes, it will close
    and reopen the log file descriptors.  We can detect this as reading just
    an eof (line == None) from the pipe and nothing else.  In this case, we
    can just reopen the log.
    When we open the log file, if reading from a server, we always set a timer
    because the open will block until something writes to the pipe.  However,
    readline() will always return and will never block.  Even at eof, if the
    other side has closed the pipe, readline() will just return None.
    The documentation on the wiki has been updated with the new information
    about how to set up the init scripts to use the logpipe.
    Platforms tested: RHEL6 x86_64
    Flag Day: no
    Doc impact: no
    (cherry picked from commit 1132e09752c8f9aba7a963bfc91a8941000012ca)