Skip to content

Commit 0eee41b

Browse files
committed
Merge branch 'backport-liveness-probe' into 'release/4.2'
back port liveness probe from main See merge request weblogic-cloud/weblogic-kubernetes-operator!4726
2 parents 1a18f84 + 2e4ed95 commit 0eee41b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

operator/src/main/resources/scripts/livenessProbe.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Copyright (c) 2017, 2023, Oracle and/or its affiliates.
3+
# Copyright (c) 2017, 2024, Oracle and/or its affiliates.
44
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
55

66
# Kubernetes periodically calls this liveness probe script to determine whether
@@ -73,10 +73,18 @@ if [ "${MOCK_WLS}" != 'true' ]; then
7373
# Adjust PATH if necessary before calling jps
7474
adjustPath
7575

76-
if [ `jps -v | grep -c " -Dweblogic.Name=${SERVER_NAME} "` -eq 0 ]; then
77-
trace SEVERE "WebLogic Server instance process not found."
76+
if [ `jps -l | grep -c " weblogic.NodeManager"` -eq 0 ]; then
77+
trace SEVERE "WebLogic NodeManager process not found."
7878
exit $RETVAL
7979
fi
80+
81+
if [ ! -f ${STATEFILE} ] || [ `grep -c "SHUT" ${STATEFILE}` -eq 0 ]; then
82+
# Only check for running server instance if the state is not SHUTDOWN or SHUTTING_DOWN
83+
if [ `jps -v | grep -c " -Dweblogic.Name=${SERVER_NAME} "` -eq 0 ]; then
84+
trace SEVERE "WebLogic Server instance process not found."
85+
exit $RETVAL
86+
fi
87+
fi
8088
fi
8189

8290
if [ -f ${STATEFILE} ] && [ `grep -c "FAILED" ${STATEFILE}` -eq 1 ]; then

0 commit comments

Comments
 (0)