Fix a bug that occasionally caused OSRF not to shut down cleanly.
The osrf_ctl.sh script had been using ps + grep to capture
the process ID (PID) of the opensrf-c daemon so that it could
send a SIGINT signal to it later to shut it down. However the
script was also capturing the PIDs of the daemon's child processes
(i.e. the listener processes), which hadn't yet changed to
application-specific names.
As a result, when shutting down, the listener processes would
receive signals from two different sources: from the opensrf-c
daemon and from the surrounding shell script. If the signal
from opensrf-c got there first, the kill from the script would
fail, and the script would abort, even though the process had
been successfully killed.
The solution is for opensrf.c to write the daemon's PID directly
to a file, instead of relying on ps + grep to capture it. The
file name is specified by an additional command line parameter,
which (for upward compatibility) is currently optional.
Because this change involves a change to the osrf_ctl.sh
script, it will be necessary to run configure before the
usual make and make install. If you are using the usual
configuration, run the following from within the OSRF
trunk directory:
./configure --prefix=/openils --sysconfdir=/openils/conf
If you don't run configure, the old osrf_ctl.sh script will
continue to work as it has in the past, and you won't get
the benefit of the change.
M include/opensrf/utils.h
M include/opensrf/osrf_system.h
M src/libopensrf/utils.c
M src/libopensrf/opensrf.c
M src/libopensrf/osrf_system.c
M bin/osrf_ctl.sh.in
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1953
9efc2488-bf62-4759-914b-
345cdb29e865