Author: doogie
Date: Mon Mar 1 18:09:52 2010
New Revision: 917622
URL:
http://svn.apache.org/viewvc?rev=917622&view=revLog:
Fix init script stop, to wait for jsvc to actually finish running. This
fixes a race condition that can occur under load, where ofbiz is not
listening on the status port, but jsvc is actually still running. This
would cause the pid file to exist, but then get removed by jsvc before
the init script could remove it itself.
Modified:
ofbiz/trunk/debian/ofbiz-framework.ofbiz.init
Modified: ofbiz/trunk/debian/ofbiz-framework.ofbiz.init
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/debian/ofbiz-framework.ofbiz.init?rev=917622&r1=917621&r2=917622&view=diff==============================================================================
--- ofbiz/trunk/debian/ofbiz-framework.ofbiz.init (original)
+++ ofbiz/trunk/debian/ofbiz-framework.ofbiz.init Mon Mar 1 18:09:52 2010
@@ -209,6 +209,19 @@
wait_for_stop() {
wait_for_status 30 "Not Running" "stop"
+ count="10"
+ while :; do
+ if ! start-stop-daemon --pidfile "$PIDFILE" --exec /usr/bin/jsvc --user $USER --signal 0 --quiet --stop; then
+ break
+ fi
+ count=$(($count - 1))
+ if [ "$count" -eq 0 ]; then
+ log_failure_msg "Timeout waiting for stop"
+ exit 1
+ fi
+ log_begin_msg "."
+ sleep 1
+ done
}
start() {
@@ -252,9 +265,9 @@
;;
(*)
ofbiz_shutdown
- wait_for_stop
;;
esac
+ wait_for_stop
if [ -e "$PIDFILE" ]; then
rm "$PIDFILE"
fi