Skip to content

Commit 3938ce1

Browse files
committed
Backport changes to operator scripts
1 parent 86c879a commit 3938ce1

File tree

12 files changed

+40
-29
lines changed

12 files changed

+40
-29
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# Copyright (c) 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2023, 2024, Oracle and/or its affiliates.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
#
55
# This script contains the all the function of creating domain on pv

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
32
# Copyright (c) 2017, 2024, Oracle and/or its affiliates.
43
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
54

operator/src/main/resources/scripts/mii-domain-upgrade.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2018, 2023, Oracle and/or its affiliates.
1+
# Copyright (c) 2018, 2024, Oracle and/or its affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
# This script is run during introspection to detect if secure production mode is enabled in

operator/src/main/resources/scripts/model_wdt_mii_filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2018, 2023, Oracle and/or its affiliates.
1+
# Copyright (c) 2018, 2024, Oracle and/or its affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33
#
44
# ------------

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
2-
3-
# Copyright (c) 2019, 2021, Oracle and/or its affiliates.
2+
# Copyright (c) 2019, 2024, Oracle and/or its affiliates.
43
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
54

65
#

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
2-
3-
# Copyright (c) 2017, 2021, Oracle and/or its affiliates.
2+
# Copyright (c) 2017, 2024, Oracle and/or its affiliates.
43
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
54

65
# Reads the current state of a server. The script checks a WebLogic Server state

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright (c) 2017, 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2017, 2024, Oracle and/or its affiliates.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44

55
#

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
2-
3-
# Copyright (c) 2017, 2022, Oracle and/or its affiliates.
2+
# Copyright (c) 2017, 2024, Oracle and/or its affiliates.
43
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
54

65
#

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

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
2-
3-
# Copyright (c) 2017, 2022, Oracle and/or its affiliates.
2+
# Copyright (c) 2017, 2024, Oracle and/or its affiliates.
43
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
54

65
#
@@ -46,17 +45,32 @@ export SHUTDOWN_TIMEOUT_ARG=${SHUTDOWN_TIMEOUT:-30}
4645
# Calculate the wait timeout to issue "kill -9" before the pod is destroyed.
4746
# Allow 3 seconds for the NFS v3 manager to detect the process destruction and release file locks.
4847
export SIGKILL_WAIT_TIMEOUT=$(expr $SHUTDOWN_TIMEOUT_ARG - 3)
49-
wait_and_kill_after_timeout(){
48+
49+
# Block until the given file appears or the given timeout is reached.
50+
wait_file() {
51+
local file="$1"; shift
52+
local wait_seconds="${1:-10}"; shift
53+
test $wait_seconds -lt 1 && echo 'At least 1 second is required' && return 1
54+
55+
until test $((wait_seconds--)) -eq 0 -o -e "$file" ; do sleep 1; done
56+
57+
test $wait_seconds -ge 0
58+
}
59+
60+
wait_and_kill_after_timeout() {
5061
trace "Wait for ${SIGKILL_WAIT_TIMEOUT} seconds for ${SERVER_NAME} to shut down." >> ${STOP_OUT_FILE}
5162
sleep ${SIGKILL_WAIT_TIMEOUT}
52-
trace "The server ${SERVER_NAME} didn't shut down in ${SIGKILL_WAIT_TIMEOUT} seconds, " \
53-
"killing the server processes." >> ${STOP_OUT_FILE}
54-
# Adjust PATH if necessary before calling jps
55-
adjustPath
56-
57-
#Specifically killing the NM first as it can auto-restart a killed WL server.
58-
kill -9 `jps -v | grep " NodeManager " | awk '{ print $1 }'`
59-
kill -9 `jps -v | grep -v Jps | awk '{ print $1 }'`
63+
wait_file "${SHUTDOWN_MARKER_FILE}" ${SIGKILL_WAIT_TIMEOUT} || {
64+
trace "The server ${SERVER_NAME} didn't shut down in ${SIGKILL_WAIT_TIMEOUT} seconds, " \
65+
"killing the server processes." >> ${STOP_OUT_FILE}
66+
# Adjust PATH if necessary before calling jps
67+
adjustPath
68+
69+
#Specifically killing the NM first as it can auto-restart a killed WL server.
70+
kill -9 `jps -v | grep " NodeManager " | awk '{ print $1 }'`
71+
kill -9 `jps -v | grep -v Jps | awk '{ print $1 }'`
72+
}
73+
6074
touch ${SHUTDOWN_MARKER_FILE}
6175
}
6276

@@ -106,8 +120,11 @@ check_for_shutdown() {
106120

107121

108122
# Check if the server is already shutdown
109-
check_for_shutdown
110-
[ $? -eq 0 ] && trace "Server is already shutting down, is shutdown or failed" &>> ${STOP_OUT_FILE} && exit 0
123+
if check_for_shutdown ; then
124+
trace "Server is already shutting down, is shutdown or failed" &>> ${STOP_OUT_FILE}
125+
touch ${SHUTDOWN_MARKER_FILE}
126+
exit 0
127+
fi
111128

112129
# Otherwise, connect to the node manager and stop the server instance
113130
[ ! -f "${SCRIPTPATH}/wlst.sh" ] && trace SEVERE "Missing file '${SCRIPTPATH}/wlst.sh'." && exit 1

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
2-
3-
# Copyright (c) 2019, 2021, Oracle and/or its affiliates.
2+
# Copyright (c) 2019, 2024, Oracle and/or its affiliates.
43
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
54

65
#

0 commit comments

Comments
 (0)