Skip to content

Commit c4d1253

Browse files
committed
move server PID and Shutdown Marker files to server log directory
1 parent 072bdec commit c4d1253

File tree

5 files changed

+23
-9
lines changed

5 files changed

+23
-9
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ else
104104
# setup ".out" location for a WL server
105105
serverLogHome="${LOG_HOME:-${DOMAIN_HOME}/servers/${SERVER_NAME}/logs}"
106106
export SERVER_OUT_FILE="${serverLogHome}/${SERVER_NAME}.out"
107+
export SERVER_PID_FILE="${serverLogHome}/${SERVER_NAME}.pid"
108+
export SHUTDOWN_MARKER_FILE="${serverLogHome}/${SERVER_NAME}.shutdown"
107109
serverOutOption="-Dweblogic.Stdout=${SERVER_OUT_FILE}"
108110
createFolder "${serverLogHome}"
109111
fi

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function startWLS() {
7272

7373
trace "Start node manager"
7474
# call script to start node manager in same shell
75-
# $SERVER_OUT_FILE will be set in startNodeManager.sh
75+
# $SERVER_OUT_FILE, SERVER_PID_FILE, and SHUTDOWN_MARKER_FILE will be set in startNodeManager.sh
7676
. ${SCRIPTPATH}/startNodeManager.sh
7777
[ $? -ne 0 ] && trace SEVERE "failed to start node manager" && exitOrLoop
7878

@@ -103,7 +103,7 @@ function waitUntilShutdown() {
103103
#
104104
if [ "${SERVER_OUT_IN_POD_LOG}" == 'true' ] ; then
105105
trace "Showing the server out file from ${SERVER_OUT_FILE}"
106-
${SCRIPTPATH}/tailLog.sh ${SERVER_OUT_FILE} &
106+
${SCRIPTPATH}/tailLog.sh ${SERVER_OUT_FILE} ${SERVER_PID_FILE} &
107107
fi
108108
FAIL_BOOT_ON_SITUATIONAL_CONFIG_ERROR=${FAIL_BOOT_ON_SITUATIONAL_CONFIG_ERROR:-true}
109109
SERVER_OUT_MONITOR_INTERVAL=${SERVER_OUT_MONITOR_INTERVAL:-3}
@@ -119,7 +119,7 @@ function waitForShutdownMarker() {
119119
#
120120
trace "Wait indefinitely so that the Kubernetes pod does not exit and try to restart"
121121
while true; do
122-
if [ -e /tmp/doShutdown ] ; then
122+
if [ -e ${SHUTDOWN_MARKER_FILE} ] ; then
123123
exit 0
124124
fi
125125
sleep 3

operator/src/main/resources/scripts/stop-server.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,20 @@ def waitUntilCoherenceSafe():
107107
print ('Shutdown: getting all service Coherence MBeans')
108108
query='Coherence:type=PartitionAssignment,service=*,*'
109109

110+
# By default, Coherence will use a single Weblogic Runtime MBean server to managed
111+
# its MBeans. That server will correspond to the current Coherence senior member,
112+
# which means that the Coherence MBeans will migrate to the oldest cluster member
113+
# during rolling restart. By using the DomainRuntime MBean server (in admin server)
114+
# we can get access to the Coherence MBeans, regardless of the local Runtime MBean
115+
# server being used, since the DomainRuntime server is federated and will call the
116+
# individual MBean servers to get the MBeans througout the domain.
117+
domainRuntime()
118+
110119
# Wait forever until we get positive ack that it is ok to shutdown this server.
111120
done = False
112121
warnSleep = True
113122
while (not done):
114123
try:
115-
domainRuntime()
116124
beans = list(mbs.queryMBeans(ObjectName(query), None))
117125
if beans is None or len(beans) == 0:
118126
# during rolling restart the beans might not be available right away

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ source ${SCRIPTPATH}/utils.sh
1616
# setup ".out" location for a WL server
1717
serverLogHome="${LOG_HOME:-${DOMAIN_HOME}/servers/${SERVER_NAME}/logs}"
1818
STOP_OUT_FILE="${serverLogHome}/${SERVER_NAME}.stop.out"
19+
SHUTDOWN_MARKER_FILE="${serverLogHome}/${SERVER_NAME}.shutdown"
20+
SERVER_PID_FILE="${serverLogHome}/${SERVER_NAME}.pid"
21+
1922

2023
trace "Stop server ${SERVER_NAME}" &>> ${STOP_OUT_FILE}
2124

2225
checkEnv SERVER_NAME || exit 1
2326

2427
if [ "${MOCK_WLS}" == 'true' ]; then
25-
touch /weblogic-operator/doShutdown
28+
touch ${SHUTDOWN_MARKER_FILE}
2629
exit 0
2730
fi
2831

@@ -79,9 +82,10 @@ if [ ! -z $pid ]; then
7982
kill -15 $pid
8083
fi
8184

82-
touch /tmp/doShutdown
83-
if [ -f /weblogic-operator/pid ]; then
84-
kill -2 $(</weblogic-operator/pid)
85+
touch ${SHUTDOWN_MARKER_FILE}
86+
87+
if [ -f ${SERVER_PID_FILE} ]; then
88+
kill -2 $(< ${SERVER_PID_FILE} )
8589
fi
8690

8791
trace "Exit script" &>> ${STOP_OUT_FILE}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
# running this script.
1111
#
1212

13-
echo $$ > /tmp/tailLog-pid
13+
echo $$ > $2
1414
tail -F -n +0 $1

0 commit comments

Comments
 (0)