1e5fbb5 Bug 677705 - ds-logpipe.py script is failing to validate "-s" and "--serverpid" options with "-t".

Authored and Committed by rmeggins 13 years ago
    Bug 677705 - ds-logpipe.py script is failing to validate "-s" and "--serverpid" options with "-t".
    
    https://bugzilla.redhat.com/show_bug.cgi?id=677705
    Resolves: bug 677705
    Bug Description: ds-logpipe.py script is failing to validate "-s" and "--serverpid" options with "-t".
    Reviewed by: nkinder (Thanks!)
    Branch: 389-ds-base-1.2.8
    Fix Description: When reading from the access log, there may be no output for
    quite some time, much longer than the timeout.  In addition, the server may
    take a long time to write its serverpid file.  This meant we would open the
    pipe, and the read would hang waiting to read from the server.  This would
    eventually timeout and exit because we did not turn off the timer, because we
    did not yet get the serverpid file.
    The fix is to just assume the server is running if open_pipe succeeds, and
    turn off the alarm.  If the server is running, the read from the pipe will
    block until either there is some output to read, or the server exits.
    I used setitimer because in the case where the server starts up and
    daemonizes, it will close and reopen the pipe.  If this is not the case,
    the short timer will ensure that the script exits quickly if the server is
    no longer running.
    NOTE: If using the script in an initconfig file, a sleep 2 will need to be
    added after starting the log pipe script, for two reasons
    * give the script time to create the log pipe before the server does
    * when a restart is issued, this gives the running log pipe script a
    chance to exit cleanly before another one is started
    Platforms tested: RHEL6 x86_64
    Flag Day: no
    Doc impact: Yes - will need to document the required initconfig changes
    (cherry picked from commit e05a918b7e9563bfcbc334c524de17d0bd9ca146)