1. Overview

WebLogic 14c 테스트 환경을 자동 재구축을 위해 모든 기본 설치 환경을 집약한다.



2. Descriptions

All-In-One-Script-For-14c.sh 실행으로 다음 환경을 구성하도록 한다.

  • AdminServer (TCP 8001 , console account : weblogic, weblogic1)
  • Managed M1 (TCP 8002)
  • Managed M2 (TCP 8003)
  • myCluster (M1, M2)
  • /sw/app/{testApp, PostDataTest} deployed on myCluster



3. Script

3.1 Engine

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
BASEDIR=/sw/downloads
OS_USERNAME=$(id --user --name)
OS_GROUPNAME=$(id --group --name)

WLS_INSTALL_FILE=${BASEDIR}/fmw_14.1.1.0.0_wls.jar
JAVA_HOME=/sw/jdk/jdk1.8.0_351

WLS_INSTALL_PATH=/sw/weblogic/14c
INVENTORY_PATH=/sw/weblogic/inventories/14c
INVENTORY_GROUP=${OS_GROUPNAME}

DOMAIN_NAME=base_domain
DOMAIN_HOME=${WLS_INSTALL_PATH}/domains/${DOMAIN_NAME}

HOSTNAME=wls.local
ADM_ADDR=${HOSTNAME}
ADM_PORT=8001
ADM_USERNAME=weblogic
ADM_PASSWORD=weblogic1

M1_SVR_NAME=M1
M1_SVR_ADDR=${HOSTNAME}
M1_SVR_PORT=8002
M2_SVR_NAME=M2
M2_SVR_ADDR=${HOSTNAME}
M2_SVR_PORT=8003
CLUSTER_NAME=myCluster

APP_HOME=/sw/app
APP_1=testApp
APP_2=PostDataTest


# (1) ResponseFile
# https://docs.oracle.com/en/middleware/fusion-middleware/12.2.1.4/ouirf/sample-response-files-silent-installation-and-deinstallation.html#GUID-65B11C03-B559-41F1-B9B4-B7276491E580

cat << EOF > ${BASEDIR}/rsp
[ENGINE]
Response File Version=1.0.0.0.0
 
[GENERIC]
DECLINE_AUTO_UPDATES=true
ORACLE_HOME=${WLS_INSTALL_PATH}
INSTALL_TYPE=WebLogic Server
EOF


# (2) Inventory
# https://docs.oracle.com/en/middleware/fusion-middleware/12.2.1.4/ouirf/using-oracle-universal-installer-silent-mode.html#GUID-756E3FD9-4094-412F-9BEB-72C5FD51056B
# * inventory.loc 파일 샘플은 문서에 없음

cat << EOF > ${BASEDIR}/loc
inventory_loc=${INVENTORY_PATH}
inst_group=${INVENTORY_GROUP}
EOF


# (3) Installation
# https://docs.oracle.com/en/middleware/fusion-middleware/12.2.1.4/ouirf/using-oracle-universal-installer-silent-mode.html#GUID-5F06D02F-6D71-45B9-BF41-5D5759D31958

${JAVA_HOME}/bin/java -jar ${WLS_INSTALL_FILE} -silent -responseFile ${BASEDIR}/rsp -invPtrLoc ${BASEDIR}/loc


3.2 Domain

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# (4) Domain
# https://docs.oracle.com/en/middleware/standalone/weblogic-server/14.1.1.0/wlstg/domains.html#GUID-5FC3AA22-BCB0-4F98-801A-8EBC5E05DC6A

${WLS_INSTALL_PATH}/wlserver/common/bin/wlst.sh << EOF
readTemplate('${WLS_INSTALL_PATH}/wlserver/common/templates/wls/wls.jar')

# https://docs.oracle.com/middleware/1213/wls/WLSTC/reference.htm#WLSTC314
setOption('JavaHome', '${JAVA_HOME}');
setOption('ServerStartMode', 'prod')
setOption('OverwriteDomain', 'true')

cd('/')
cd('Security/base_domain/User/${ADM_USERNAME}')
cmo.setPassword('${ADM_PASSWORD}')

cd('Servers/AdminServer')
set('ListenAddress','${ADM_ADDR}')
set('ListenPort', ${ADM_PORT})

writeDomain('${DOMAIN_HOME}')
closeTemplate()

exit()
EOF


3.3 Startup AdminServer

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# (5) Create boot.properties
cat << EOF > ${DOMAIN_HOME}/boot.properties
username=${ADM_USERNAME}
password=${ADM_PASSWORD}
EOF


# (6) Start-up AdminServer
# https://unix.stackexchange.com/questions/405250/passing-and-setting-variables-in-a-heredoc

DATE=$(date +%Y%m%d_%H%M%S)
tmpStdFile=/tmp/AdminServer.${DATE}
nohup ${DOMAIN_HOME}/bin/startWebLogic.sh "-Dweblogic.system.BootIdentityFile=${DOMAIN_HOME}/boot.properties" > ${tmpStdFile} 2>&1 &

bash << EOF
while true
do
 R="\$(grep "RUNNING mode" ${tmpStdFile})"
 if [ "x\${R}" == "x" ]; then
  sleep 3
  echo "Sleeping for 3 Seconds"
  else
  echo "AdminServer has Started"
  break;
 fi
done
EOF


3.4 Create Managed Server

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# (7) Create Managed Servers
# https://oracle-base.com/articles/web/wlst-create-managed-server

. ${DOMAIN_HOME}/bin/setDomainEnv.sh
java weblogic.WLST << EOF
connect('${ADM_USERNAME}','${ADM_PASSWORD}','${ADM_ADDR}:${ADM_PORT}')
edit()
startEdit()

## Create Managed
cd('/')
cmo.createServer('${M1_SVR_NAME}')
cd('/Servers/${M1_SVR_NAME}')
cmo.setListenAddress('${M1_SVR_ADDR}')
cmo.setListenPort(${M1_SVR_PORT})

cd('/Servers/${M1_SVR_NAME}/Log/${M1_SVR_NAME}')
cmo.setLogFileSeverity("Info")
cmo.setStdoutSeverity("Info")
cmo.setDomainLogBroadcastSeverity("Off")
cmo.setRotationType("byTime")

cd('/Servers/${M1_SVR_NAME}/WebServer/${M1_SVR_NAME}/WebServerLog/${M1_SVR_NAME}')
cmo.setNumberOfFilesLimited(True)
cmo.setRotationType("byTime")

cd('/')
cmo.createServer('${M2_SVR_NAME}')
cd('/Servers/${M2_SVR_NAME}')
cmo.setListenAddress('${M2_SVR_ADDR}')
cmo.setListenPort(${M2_SVR_PORT})

cd('/Servers/${M2_SVR_NAME}/Log/${M2_SVR_NAME}')
cmo.setLogFileSeverity("Info")
cmo.setStdoutSeverity("Info")
cmo.setDomainLogBroadcastSeverity("Off")
cmo.setRotationType("byTime")

cd('/Servers/${M2_SVR_NAME}/WebServer/${M2_SVR_NAME}/WebServerLog/${M2_SVR_NAME}')
cmo.setNumberOfFilesLimited(True)
cmo.setRotationType("byTime")

save()
activate()
disconnect()
exit()
EOF


3.5 Cluster

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# (8) Assign Managed Server to Cluster
# https://oracle-base.com/articles/web/wlst-create-managed-server
# https://oracle-base.com/articles/web/wlst-create-cluster

. ${DOMAIN_HOME}/bin/setDomainEnv.sh
java weblogic.WLST << EOF
connect('${ADM_USERNAME}','${ADM_PASSWORD}','${ADM_ADDR}:${ADM_PORT}')
edit()
startEdit()

## Create Cluster
cd('/')
cmo.createCluster('${CLUSTER_NAME}')
cd('/Clusters/${CLUSTER_NAME}')
cmo.setClusterMessagingMode('unicast')

## Assign Managed to Cluster
cd('/')
cd('/Servers/${M1_SVR_NAME}')
cmo.setCluster(getMBean('/Clusters/${CLUSTER_NAME}'))

cd('/')
cd('/Servers/${M2_SVR_NAME}')
cmo.setCluster(getMBean('/Clusters/${CLUSTER_NAME}'))

save()
activate()
disconnect()
exit()
EOF


3.6 Deploy App

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# (9) Deploy App
# https://docs.oracle.com/middleware/1213/wls/WLSTC/reference.htm#WLSTC200
. ${DOMAIN_HOME}/bin/setDomainEnv.sh
java weblogic.WLST << EOF
connect('${ADM_USERNAME}','${ADM_PASSWORD}','${ADM_ADDR}:${ADM_PORT}')
edit()
startEdit()

deploy(appName='${APP_1}', path='${APP_HOME}/${APP_1}', targets='${CLUSTER_NAME}', stageMode='nostage', block='true')
deploy(appName='${APP_2}', path='${APP_HOME}/${APP_2}', targets='${CLUSTER_NAME}', stageMode='nostage', block='true')
startApplication('${APP_1}')
startApplication('${APP_2}')

#stopApplication('${APP_1}')
#stopApplication('${APP_2}')
#undeploy(appName='${APP_1}')
#undeploy(appName='${APP_2}')

save()
activate()
disconnect()
exit()
EOF


3.7. Create Instances Scripts

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# (10) Create Instance Scripts
# AdminServer (start, stop, log, ps)
cat << "EOF" > ${DOMAIN_HOME}/startA.sh
#!/bin/sh
DOMAIN_NAME=#DOMAIN_NAME#
DOMAIN_HOME=#DOMAIN_HOME#
SERVER_NAME=#SERVER_NAME#
SERVER_PORT=#SERVER_PORT#
BOOT_PROPERTIES=${DOMAIN_HOME}/boot.properties

LOG_HOME=${DOMAIN_HOME}/logs
NOHUP_LOG=${LOG_HOME}/nohup
GC_LOG=${LOG_HOME}/gc
HEAPDUMP_DIR=${LOG_HOME}/heapdump
LOG_TIME=$(date +%y%m%d_%H%M)

##### Make Path #####
mkdir -p ${LOG_HOME} ${NOHUP_LOG} ${GC_LOG} ${HEAPDUMP_DIR}
###################

##### User Check #####
USER=#OS_USERNAME#
if [ "$USER" != $(/usr/bin/whoami) ]; then
     echo "* you do not have permission. *"
     exit;
fi
####################

## Process Check ##
WAS_PID=$(${DOMAIN_HOME}/psA.sh)
if [ "$WAS_PID" != "" ]; then
     echo "Server already Started."
     exit;
fi
###################

##### gc log rotation #####
mv ${GC_LOG}/gc_${SERVER_NAME}.out ${GC_LOG}/gc_${SERVER_NAME}.out.${LOG_TIME}
USER_MEM_ARGS="${USER_MEM_ARGS} -verbose:gc -Xloggc:${GC_LOG}/gc_${SERVER_NAME}.out"
######################

##### Heap dump #####
USER_MEM_ARGS="${USER_MEM_ARGS} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${HEAPDUMP_DIR}"
####################

JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.system.BootIdentityFile=${BOOT_PROPERTIES}"
export JAVA_OPTIONS

USER_MEM_ARGS="${USER_MEM_ARGS} -D${SERVER_NAME}"
USER_MEM_ARGS="${USER_MEM_ARGS} -Dserver.name=${SERVER_NAME} -Dserver.port=${SERVER_PORT}"
USER_MEM_ARGS="${USER_MEM_ARGS} -Xms1024m -Xmx1024m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m"
USER_MEM_ARGS="${USER_MEM_ARGS} -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv6Addresses=false -Dweblogic.wsee.skip.async.response=true"
USER_MEM_ARGS="${USER_MEM_ARGS} -D_Offline_FileDataArchive=true -Dweblogic.connector.ConnectionPoolProfilingEnabled=false -Dcom.bea.wlw.netui.disableInstrumentation=true"
export USER_MEM_ARGS

mv ${NOHUP_LOG}/${SERVER_NAME}.out ${NOHUP_LOG}/${SERVER_NAME}.out.${LOG_TIME}
nohup ${DOMAIN_HOME}/bin/startWebLogic.sh > ${NOHUP_LOG}/${SERVER_NAME}.out 2>&1 &
#sleep 1
#tail -f ${NOHUP_LOG}/${SERVER_NAME}.out
EOF


cat << "EOF" > ${DOMAIN_HOME}/stopA.sh
#!/bin/sh
DOMAIN_HOME=#DOMAIN_HOME#
SERVER_ADDR=#SERVER_ADDR#
SERVER_PORT=#SERVER_PORT#

. ${DOMAIN_HOME}/bin/setDomainEnv.sh

##### User Check #####
USER=#OS_USERNAME#
if [ "$USER" != $(/usr/bin/whoami) ]; then
     echo "* you do not have permission. *"
     exit;
fi
####################

## Process Check ##
WAS_PID=$(${DOMAIN_HOME}/psA.sh)
if [ "$WAS_PID" == "" ]; then
     echo "Server already Stopped."
     exit;
fi
###################

java weblogic.WLST << INNER_EOF
connect(url='${SERVER_ADDR}:${SERVER_PORT}')
shutdown(force='true')
exit()
INNER_EOF
EOF


cat << "EOF" > ${DOMAIN_HOME}/logA.sh
#!/bin/sh
DOMAIN_HOME=#DOMAIN_HOME#
SERVER_NAME=#SERVER_NAME#

LOG_HOME=${DOMAIN_HOME}/logs
NOHUP_LOG=${LOG_HOME}/nohup
tail -10f ${NOHUP_LOG}/${SERVER_NAME}.out
EOF


cat << "EOF" > ${DOMAIN_HOME}/psA.sh
#!/bin/sh
SERVER_NAME=#SERVER_NAME#
ps -ef | grep "java" | grep "weblogic.Server" | grep "D${SERVER_NAME}"
EOF

sed -i "s|#OS_USERNAME#|${OS_USERNAME}|g" ${DOMAIN_HOME}/*A.sh
sed -i "s|#DOMAIN_NAME#|${DOMAIN_NAME}|g" ${DOMAIN_HOME}/*A.sh
sed -i "s|#DOMAIN_HOME#|${DOMAIN_HOME}|g" ${DOMAIN_HOME}/*A.sh
sed -i "s|#SERVER_NAME#|AdminServer|g" ${DOMAIN_HOME}/*A.sh
sed -i "s|#SERVER_ADDR#|${ADM_ADDR}|g" ${DOMAIN_HOME}/*A.sh
sed -i "s|#SERVER_PORT#|${ADM_PORT}|g" ${DOMAIN_HOME}/*A.sh


# Managed Server (start, stop, log, ps)
cat << "EOF" > ${DOMAIN_HOME}/startM.sh
#!/bin/sh
DOMAIN_NAME=#DOMAIN_NAME#
DOMAIN_HOME=#DOMAIN_HOME#
SERVER_NAME=#SERVER_NAME#
SERVER_PORT=#SERVER_PORT#
ADM_URL="t3://#ADM_ADDR#:#ADM_PORT#"
BOOT_PROPERTIES=${DOMAIN_HOME}/boot.properties

LOG_HOME=${DOMAIN_HOME}/logs
NOHUP_LOG=${LOG_HOME}/nohup
GC_LOG=${LOG_HOME}/gc
HEAPDUMP_DIR=${LOG_HOME}/heapdump
LOG_TIME=$(date +%y%m%d_%H%M)

##### Make Path #####
mkdir -p ${LOG_HOME} ${NOHUP_LOG} ${GC_LOG} ${HEAPDUMP_DIR}
###################

##### User Check #####
USER=#OS_USERNAME#
if [ "$USER" != $(/usr/bin/whoami) ]; then
     echo "* you do not have permission. *"
     exit;
fi
####################

## Process Check ##
WAS_PID=$(${DOMAIN_HOME}/ps${SERVER_NAME}.sh)
if [ "$WAS_PID" != "" ]; then
     echo "Server already Started."
     exit;
fi
###################

##### gc log rotation #####
mv ${GC_LOG}/gc_${SERVER_NAME}.out ${GC_LOG}/gc_${SERVER_NAME}.out.${LOG_TIME}
USER_MEM_ARGS="${USER_MEM_ARGS} -verbose:gc -Xloggc:${GC_LOG}/gc_${SERVER_NAME}.out"
######################

##### Heap dump #####
USER_MEM_ARGS="${USER_MEM_ARGS} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${HEAPDUMP_DIR}"
####################

JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.system.BootIdentityFile=${BOOT_PROPERTIES}"
export JAVA_OPTIONS

USER_MEM_ARGS="${USER_MEM_ARGS} -D${SERVER_NAME}"
USER_MEM_ARGS="${USER_MEM_ARGS} -Dserver.name=${SERVER_NAME} -Dserver.port=${SERVER_PORT}"
USER_MEM_ARGS="${USER_MEM_ARGS} -Xms1024m -Xmx1024m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m"
USER_MEM_ARGS="${USER_MEM_ARGS} -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv6Addresses=false -Dweblogic.wsee.skip.async.response=true"
USER_MEM_ARGS="${USER_MEM_ARGS} -D_Offline_FileDataArchive=true -Dweblogic.connector.ConnectionPoolProfilingEnabled=false -Dcom.bea.wlw.netui.disableInstrumentation=true"
export USER_MEM_ARGS

mv ${NOHUP_LOG}/${SERVER_NAME}.out ${NOHUP_LOG}/${SERVER_NAME}.out.${LOG_TIME}
nohup ${DOMAIN_HOME}/bin/startManagedWebLogic.sh ${SERVER_NAME} ${ADM_URL}> ${NOHUP_LOG}/${SERVER_NAME}.out 2>&1 &
#sleep 1
#tail -f ${NOHUP_LOG}/${SERVER_NAME}.out
EOF


cat << "EOF" > ${DOMAIN_HOME}/stopM.sh
#!/bin/sh
DOMAIN_HOME=#DOMAIN_HOME#
SERVER_NAME=#SERVER_NAME#
SERVER_ADDR=#SERVER_ADDR#
SERVER_PORT=#SERVER_PORT#

. ${DOMAIN_HOME}/bin/setDomainEnv.sh

##### User Check #####
USER=#OS_USERNAME#
if [ "$USER" != $(/usr/bin/whoami) ]; then
     echo "* you do not have permission. *"
     exit;
fi
####################

## Process Check ##
WAS_PID=$(${DOMAIN_HOME}/ps${SERVER_NAME}.sh)
if [ "$WAS_PID" == "" ]; then
     echo "Server already Stopped."
     exit;
fi
###################

java weblogic.WLST << INNER_EOF
connect(url='${SERVER_ADDR}:${SERVER_PORT}')
shutdown(force='true')
exit()
INNER_EOF
EOF


cat << "EOF" > ${DOMAIN_HOME}/logM.sh
#!/bin/sh
DOMAIN_HOME=#DOMAIN_HOME#
SERVER_NAME=#SERVER_NAME#

LOG_HOME=${DOMAIN_HOME}/logs
NOHUP_LOG=${LOG_HOME}/nohup
tail -10f ${NOHUP_LOG}/${SERVER_NAME}.out
EOF


cat << "EOF" > ${DOMAIN_HOME}/psM.sh
#!/bin/sh
SERVER_NAME=#SERVER_NAME#
ps -ef | grep "java" | grep "weblogic.Server" | grep "D${SERVER_NAME}"
EOF


cp ${DOMAIN_HOME}/startM.sh ${DOMAIN_HOME}/start${M1_SVR_NAME}.sh
cp ${DOMAIN_HOME}/stopM.sh ${DOMAIN_HOME}/stop${M1_SVR_NAME}.sh
cp ${DOMAIN_HOME}/logM.sh ${DOMAIN_HOME}/log${M1_SVR_NAME}.sh
cp ${DOMAIN_HOME}/psM.sh ${DOMAIN_HOME}/ps${M1_SVR_NAME}.sh

cp ${DOMAIN_HOME}/startM.sh ${DOMAIN_HOME}/start${M2_SVR_NAME}.sh
cp ${DOMAIN_HOME}/stopM.sh ${DOMAIN_HOME}/stop${M2_SVR_NAME}.sh
cp ${DOMAIN_HOME}/logM.sh ${DOMAIN_HOME}/log${M2_SVR_NAME}.sh
cp ${DOMAIN_HOME}/psM.sh ${DOMAIN_HOME}/ps${M2_SVR_NAME}.sh

sed -i "s|#OS_USERNAME#|${OS_USERNAME}|g" ${DOMAIN_HOME}/*${M1_SVR_NAME}.sh
sed -i "s|#DOMAIN_NAME#|${DOMAIN_NAME}|g" ${DOMAIN_HOME}/*${M1_SVR_NAME}.sh
sed -i "s|#DOMAIN_HOME#|${DOMAIN_HOME}|g" ${DOMAIN_HOME}/*${M1_SVR_NAME}.sh
sed -i "s|#SERVER_NAME#|${M1_SVR_NAME}|g" ${DOMAIN_HOME}/*${M1_SVR_NAME}.sh
sed -i "s|#SERVER_ADDR#|${M1_SVR_ADDR}|g" ${DOMAIN_HOME}/*${M1_SVR_NAME}.sh
sed -i "s|#SERVER_PORT#|${M1_SVR_PORT}|g" ${DOMAIN_HOME}/*${M1_SVR_NAME}.sh
sed -i "s|#ADM_ADDR#|${ADM_ADDR}|g" ${DOMAIN_HOME}/*${M1_SVR_NAME}.sh
sed -i "s|#ADM_PORT#|${ADM_PORT}|g" ${DOMAIN_HOME}/*${M1_SVR_NAME}.sh

sed -i "s|#OS_USERNAME#|${OS_USERNAME}|g" ${DOMAIN_HOME}/*${M2_SVR_NAME}.sh
sed -i "s|#DOMAIN_NAME#|${DOMAIN_NAME}|g" ${DOMAIN_HOME}/*${M2_SVR_NAME}.sh
sed -i "s|#DOMAIN_HOME#|${DOMAIN_HOME}|g" ${DOMAIN_HOME}/*${M2_SVR_NAME}.sh
sed -i "s|#SERVER_NAME#|${M2_SVR_NAME}|g" ${DOMAIN_HOME}/*${M2_SVR_NAME}.sh
sed -i "s|#SERVER_ADDR#|${M2_SVR_ADDR}|g" ${DOMAIN_HOME}/*${M2_SVR_NAME}.sh
sed -i "s|#SERVER_PORT#|${M2_SVR_PORT}|g" ${DOMAIN_HOME}/*${M2_SVR_NAME}.sh
sed -i "s|#ADM_ADDR#|${ADM_ADDR}|g" ${DOMAIN_HOME}/*${M2_SVR_NAME}.sh
sed -i "s|#ADM_PORT#|${ADM_PORT}|g" ${DOMAIN_HOME}/*${M2_SVR_NAME}.sh

chmod 700 ${DOMAIN_HOME}/*.sh
rm ${DOMAIN_HOME}/*M.sh