403281 jetty.sh waits for started or failure before returning

This commit is contained in:
Greg Wilkins 2013-03-22 11:30:43 +11:00
parent 1eea7a2a89
commit e083f9d95a
1 changed files with 14 additions and 8 deletions

View File

@ -106,7 +106,7 @@ findDirectory()
running()
{
local PID=$(head -n 1 "$1" 2>/dev/null) || return 1
local PID=$(cat "$1" 2>/dev/null) || return 1
kill -0 "$PID" 2>/dev/null
}
@ -119,7 +119,7 @@ started()
[ -z "$(grep STARTED $1)" ] || return 0
[ -z "$(grep STOPPED $1)" ] || return 1
[ -z "$(grep FAILED $1)" ] || return 1
local PID=$(head -n 1 "$1" 2>/dev/null) || return 1
local PID=$(cat "$2" 2>/dev/null) || return 1
kill -0 "$PID" 2>/dev/null || return 1
echo -n ". "
done
@ -342,7 +342,9 @@ if [ -z "$JETTY_PID" ]
then
JETTY_PID="$JETTY_RUN/jetty.pid"
fi
JAVA_OPTIONS+=("-Djetty.pid=$JETTY_PID")
JETTY_STATE=$(dirname $JETTY_PID)/jetty.state
JAVA_OPTIONS+=("-Djetty.state=$JETTY_STATE")
rm -f $JETTY_STATE
##################################################
# Setup JAVA if unset
@ -473,12 +475,16 @@ case "$ACTION" in
fi
if started "$JETTY_PID"
if expr "${CONFIGS[*]}" : '.*etc/jetty-started.xml.*' >/dev/null
then
echo "OK `date`"
if started "$JETTY_STATE" "$JETTY_PID"
then
echo "OK `date`"
else
echo "FAILED `date`"
fi
else
echo "FAILED `date`"
exit 1
echo "ok `date`"
fi
;;
@ -500,7 +506,7 @@ case "$ACTION" in
rm -f "$JETTY_PID"
echo OK
else
PID=$(head -n 1 "$JETTY_PID" 2>/dev/null)
PID=$(cat "$JETTY_PID" 2>/dev/null)
kill "$PID" 2>/dev/null
TIMEOUT=30