Skip to content

Commit

Permalink
Issue jetty#7182 having running() delete the state file where it prev…
Browse files Browse the repository at this point in the history
…iously only deleted the pid file.

Signed-off-by: Ian Rifkin <[email protected]>
  • Loading branch information
ianrifkin committed Dec 1, 2021
1 parent 5b153e1 commit c4c7c98
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions jetty-home/src/main/resources/bin/jetty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ running()
return
fi
rm -f "$1"
rm -f "$2"
return 1
}

Expand Down Expand Up @@ -475,7 +476,7 @@ case "$ACTION" in

else

if running $JETTY_PID
if running $JETTY_PID $JETTY_STATE
then
echo "Already Running $(cat $JETTY_PID)!"
exit 1
Expand Down Expand Up @@ -526,7 +527,7 @@ case "$ACTION" in
start-stop-daemon -K -p"$JETTY_PID" -d"$JETTY_HOME" -a "$JAVA" -s HUP

TIMEOUT=30
while running "$JETTY_PID"; do
while running "$JETTY_PID" "$JETTY_STATE"; do
if (( TIMEOUT-- == 0 )); then
start-stop-daemon -K -p"$JETTY_PID" -d"$JETTY_HOME" -a "$JAVA" -s KILL
fi
Expand All @@ -547,7 +548,7 @@ case "$ACTION" in
kill "$PID" 2>/dev/null

TIMEOUT=30
while running $JETTY_PID; do
while running $JETTY_PID $JETTY_STATE; do
if (( TIMEOUT-- == 0 )); then
kill -KILL "$PID" 2>/dev/null
fi
Expand Down Expand Up @@ -590,7 +591,7 @@ case "$ACTION" in
run|demo)
echo "Running Jetty: "

if running "$JETTY_PID"
if running "$JETTY_PID" "$JETTY_STATE"
then
echo Already Running $(cat "$JETTY_PID")!
exit 1
Expand All @@ -600,7 +601,7 @@ case "$ACTION" in
;;

check|status)
if running "$JETTY_PID"
if running "$JETTY_PID" "$JETTY_STATE"
then
echo "Jetty running pid=$(< "$JETTY_PID")"
else
Expand All @@ -610,7 +611,7 @@ case "$ACTION" in
dumpEnv
echo

if running "$JETTY_PID"
if running "$JETTY_PID" "$JETTY_STATE"
then
exit 0
fi
Expand Down

0 comments on commit c4c7c98

Please sign in to comment.