|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | | -# Copyright 2017, 2018, Oracle Corporation and/or its affiliates. All rights reserved. |
| 3 | +# Copyright 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved. |
4 | 4 | # Licensed under the Universal Permissive License v 1.0 as shown at |
5 | 5 | # http://oss.oracle.com/licenses/upl. |
6 | 6 |
|
7 | 7 | # Kubernetes periodically calls this liveness probe script to determine whether |
8 | 8 | # the pod should be restarted. The script checks a WebLogic Server state file which |
9 | 9 | # is updated by the node manager. |
10 | 10 |
|
| 11 | +# if the livenessProbeSuccessOverride file is available, treat failures as success: |
| 12 | +RETVAL=$(test -f /weblogic-operator/debug/livenessProbeSuccessOverride ; echo $?) |
| 13 | + |
| 14 | +SCRIPTPATH="$( cd "$(dirname "$0")" > /dev/null 2>&1 ; pwd -P )" |
| 15 | +source ${SCRIPTPATH}/traceUtils.sh |
| 16 | +[ $? -ne 0 ] && echo "Error: missing file ${SCRIPTPATH}/traceUtils.sh" && exit $RETVAL |
| 17 | + |
| 18 | +# check DOMAIN_HOME for a config/config.xml, reset DOMAIN_HOME if needed: |
| 19 | +exportEffectiveDomainHome || exit $RETVAL |
| 20 | + |
11 | 21 | DN=${DOMAIN_NAME?} |
12 | 22 | SN=${SERVER_NAME?} |
13 | 23 | DH=${DOMAIN_HOME?} |
14 | 24 |
|
15 | 25 | STATEFILE=${DH}/servers/${SN}/data/nodemanager/${SN}.state |
16 | 26 |
|
17 | | -# if the livenessProbeSuccessOverride file is available, treat failures as success |
18 | | -# |
19 | | -RETVAL=$(test -f /weblogic-operator/debug/livenessProbeSuccessOverride ; echo $?) |
20 | | - |
21 | 27 | if [ "${MOCK_WLS}" != 'true' ]; then |
22 | 28 | if [ `jps -l | grep -c " weblogic.NodeManager"` -eq 0 ]; then |
23 | | - echo "Error: WebLogic NodeManager process not found." |
| 29 | + trace "Error: WebLogic NodeManager process not found." |
24 | 30 | exit $RETVAL |
25 | 31 | fi |
26 | 32 | fi |
27 | 33 | if [ -f ${STATEFILE} ] && [ `grep -c "FAILED_NOT_RESTARTABLE" ${STATEFILE}` -eq 1 ]; then |
28 | | - echo "Error: WebLogic Server state is FAILED_NOT_RESTARTABLE." |
| 34 | + trace "Error: WebLogic Server state is FAILED_NOT_RESTARTABLE." |
29 | 35 | exit $RETVAL |
30 | 36 | fi |
31 | 37 | exit 0 |
0 commit comments