Fix a bug that occasionally caused OSRF not to shut down cleanly.
authorscottmk <scottmk@9efc2488-bf62-4759-914b-345cdb29e865>
Tue, 4 May 2010 13:41:16 +0000 (13:41 +0000)
committerscottmk <scottmk@9efc2488-bf62-4759-914b-345cdb29e865>
Tue, 4 May 2010 13:41:16 +0000 (13:41 +0000)
commitf2b812138a4328972f5ae0dec6bd6e4f0938f2e3
treea139d355f7902bf7bf8d21e259dfeec0a13e8a19
parent3e175e856c6348e17aa6bc2ecddb958597f4d1a4
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
bin/osrf_ctl.sh.in
include/opensrf/osrf_system.h
include/opensrf/utils.h
src/libopensrf/opensrf.c
src/libopensrf/osrf_system.c
src/libopensrf/utils.c