@@ -13,7 +13,7 @@ SCRIPTPATH="$( cd "$(dirname "$0")" > /dev/null 2>&1 ; pwd -P )"
13
13
source ${SCRIPTPATH} /traceUtils.sh
14
14
[ $? -ne 0 ] && echo " Error: missing file ${SCRIPTPATH} /traceUtils.sh" && exit 1
15
15
16
- trace " Stop server ${SERVER_NAME} " & >> /weblogic-operator/stopserver.out
16
+ trace " Stop server ${SERVER_NAME} " & >> ${SERVER_OUT_FILE}
17
17
18
18
checkEnv SERVER_NAME || exit 1
19
19
@@ -28,27 +28,31 @@ function check_for_shutdown() {
28
28
state=` ${SCRIPTPATH} /readState.sh`
29
29
exit_status=$?
30
30
if [ $exit_status -ne 0 ]; then
31
- trace " Node manager not running or server instance not found; assuming shutdown" & >> /weblogic-operator/stopserver.out
31
+ trace " Node manager not running or server instance not found; assuming shutdown" & >> ${SERVER_OUT_FILE}
32
32
return 0
33
33
fi
34
34
35
35
if [ " $state " = " SHUTDOWN" ]; then
36
- trace " Server is shutdown" & >> /weblogic-operator/stopserver.out
36
+ trace " Server is shutdown" & >> ${SERVER_OUT_FILE}
37
37
return 0
38
38
fi
39
39
40
40
if [[ " $state " =~ ^FAILED ]]; then
41
- trace " Server in failed state" & >> /weblogic-operator/stopserver.out
41
+ trace " Server in failed state" & >> ${SERVER_OUT_FILE}
42
42
return 0
43
43
fi
44
44
45
- trace " Server is currently in state $state " & >> /weblogic-operator/stopserver.out
45
+ trace " Server is currently in state $state " & >> ${SERVER_OUT_FILE}
46
46
return 1
47
47
}
48
48
49
+ # setup ".out" location for a WL server
50
+ serverLogHome=" ${LOG_HOME:- ${DOMAIN_HOME} / servers/ ${SERVER_NAME} / logs} "
51
+ SERVER_OUT_FILE=" ${serverLogHome} /stop-${SERVER_NAME} .out"
52
+
49
53
# Check if the server is already shutdown
50
54
check_for_shutdown
51
- [ $? -eq 0 ] && trace " Server already shutdown or failed" & >> /weblogic-operator/stopserver.out && exit 0
55
+ [ $? -eq 0 ] && trace " Server already shutdown or failed" & >> ${SERVER_OUT_FILE} && exit 0
52
56
53
57
# Otherwise, connect to the node manager and stop the server instance
54
58
[ ! -f " ${SCRIPTPATH} /wlst.sh" ] && trace " Error: missing file '${SCRIPTPATH} /wlst.sh'." && exit 1
@@ -60,23 +64,23 @@ export SHUTDOWN_TIMEOUT_ARG=${SHUTDOWN_TIMEOUT:-30}
60
64
export SHUTDOWN_IGNORE_SESSIONS_ARG=${SHUTDOWN_IGNORE_SESSIONS:- false}
61
65
export SHUTDOWN_TYPE_ARG=${SHUTDOWN_TYPE:- Graceful}
62
66
63
- trace " Before stop-server.py [${SERVER_NAME} ] ${SCRIPTDIR} " & >> /weblogic-operator/stopserver.out
64
- ${SCRIPTPATH} /wlst.sh /weblogic-operator/scripts/stop-server.py & >> /weblogic-operator/stopserver.out
65
- trace " After stop-server.py" & >> /weblogic-operator/stopserver.out
67
+ trace " Before stop-server.py [${SERVER_NAME} ] ${SCRIPTDIR} " & >> ${SERVER_OUT_FILE}
68
+ ${SCRIPTPATH} /wlst.sh /weblogic-operator/scripts/stop-server.py & >> ${SERVER_OUT_FILE}
69
+ trace " After stop-server.py" & >> ${SERVER_OUT_FILE}
66
70
67
71
# at this point node manager should have terminated the server
68
72
# but let's try looking for the server process and
69
73
# kill the server if the process still exists,
70
74
# just in case we failed to stop it via wlst
71
75
pid=$( jps -v | grep " -Dweblogic.Name=${SERVER_NAME} " | awk ' {print $1}' )
72
76
if [ ! -z $pid ]; then
73
- echo " Killing the server process $pid " & >> /weblogic-operator/stopserver.out
77
+ echo " Killing the server process $pid " & >> ${SERVER_OUT_FILE}
74
78
kill -15 $pid
75
79
fi
76
80
77
- touch ${DOMAIN_HOME} /doShutdown
81
+ touch /tmp /doShutdown
78
82
if [ -f /weblogic-operator/pid ]; then
79
83
kill -2 $( < /weblogic-operator/pid)
80
84
fi
81
85
82
- trace " Exit script" & >> /weblogic-operator/stopserver.out
86
+ trace " Exit script" & >> ${SERVER_OUT_FILE}
0 commit comments