+12
-8
@@ -76,15 +76,19 @@ host_pids() {
|
||||
HOST_PIDS=$(host_pids)
|
||||
|
||||
if [ -z "$HOST_PIDS" ]; then
|
||||
# Nothing to kill on the host and no running containers. Either Maven is
|
||||
# already down, or it is somewhere this script cannot see (another PID
|
||||
# namespace, another user, docker unreachable). We cannot tell the
|
||||
# difference, so refuse to claim success.
|
||||
echo "ERROR: found no Maven processes on this host and no running containers." >&2
|
||||
if [ "$DOCKER_OK" != 1 ]; then
|
||||
echo " Could not ask docker either — if this is the container deploy," >&2
|
||||
echo " run: docker compose -f $COMPOSE_FILE stop" >&2
|
||||
# Nothing on the host. Whether that means "already down" depends on whether
|
||||
# we managed to ask docker, and the two must not read the same.
|
||||
if [ "$DOCKER_OK" = 1 ]; then
|
||||
# Docker answered and named no running containers, and there is nothing
|
||||
# on the host either. That is a real answer: Maven is already stopped.
|
||||
echo "Nothing to stop: no Maven processes and no running containers."
|
||||
exit 0
|
||||
fi
|
||||
# We could not ask docker, so Maven may be alive in a container we cannot
|
||||
# see. Saying "stopped" here is the exact false success this script had.
|
||||
echo "ERROR: no Maven processes on this host, and docker could not be asked." >&2
|
||||
echo " If this is the container deploy it may still be running:" >&2
|
||||
echo " docker compose -f $COMPOSE_FILE stop" >&2
|
||||
echo " Nothing was stopped. Check by hand before assuming Maven is down." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user