-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguiConfig
396 lines (356 loc) · 15.7 KB
/
guiConfig
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
#!/bin/bash
ejbMenu(){
clear
EJB_CONFIG_WAS_SVN="$PATH_TO_EJB_FILES/ejbConfigWas.txt"
EJB_CONFIG_PORTAL_SVN="$PATH_TO_EJB_FILES/ejbConfigPortal.txt"
echo "1. Skontrolovat EJB config WAS "
echo "2. Skontrolovat EJB config PORTAL "
echo " 0. back"
echo " 00. exit"
echo -n "Vyber moznost: "
read -n1 ejbMenuOption
clear
case $ejbMenuOption in
1 ) controlEJBCustomProperties "was"; ejbMenu ;;
2 ) controlEJBCustomProperties "portal"; ejbMenu ;;
3 ) createEjbCustomPropFile; ejbMenu ;;
4 ) createEjbCustomPropFilePortal; ejbMenu ;;
0) clear; menu ;;
00) clear; exit ;;
"") ;;
*) clear; echo "Chybne zadany vstup"; sleep 1; ejbMenu ;;
esac
}
controlEJBCustomProperties(){
if [ "$1" == "portal" ]
then
local ejbResourceXmlStart=$(ssh $PORTAL_HOST_USER@$PORTAL_HOST "cat $WAS_SERVER_DIR/../wp_profile/config/cells/$PORTAL_CELL/resources.xml | grep 'RemoteEJBLocatorReference' -n | cut -d ':' -f1")
local tmpFile="$EJB_CONFIG_PORTAL_SVN"
local resourceFileSize=$(ssh $PORTAL_HOST_USER@$PORTAL_HOST "cat $WAS_SERVER_DIR/../wp_profile/config/cells/$PORTAL_CELL/resources.xml | wc -l")
local ejbResourceXmlEnd=$(ssh $PORTAL_HOST_USER@$PORTAL_HOST "cat $WAS_SERVER_DIR/../wp_profile/config/cells/$PORTAL_CELL/resources.xml | sed \"$ejbResourceXmlStart,$resourceFileSize!d\" | grep '</propertySet>' -n | cut -d ':' -f1 | head -n 1")
let "ejbResourceXmlEnd=$(echo $ejbResourceXmlEnd) + $(echo $ejbResourceXmlStart)"
local EJB_CONGIF_FULL_FROM_RESOURCE_XML=$(ssh $PORTAL_HOST_USER@$PORTAL_HOST "cat $WAS_SERVER_DIR/../wp_profile/config/cells/$PORTAL_CELL/resources.xml | sed \"$ejbResourceXmlStart,$ejbResourceXmlEnd!d\" | sed 's/ //g'")
else
local ejbResourceXmlStart=$(ssh $WAS_HOST_USER@$WAS_HOST "cat $WAS_SERVER_DIR/profiles/$WAS_PROFILE/config/cells/$WAS_CELL/resources.xml | grep 'RemoteEJBLocatorReference' -n | cut -d ':' -f1")
local tmpFile="$EJB_CONFIG_WAS_SVN"
local resourceFileSize=$(ssh $WAS_HOST_USER@$WAS_HOST "cat $WAS_SERVER_DIR/profiles/$WAS_PROFILE/config/cells/$WAS_CELL/resources.xml | wc -l")
local ejbResourceXmlEnd=$(ssh $WAS_HOST_USER@$WAS_HOST "cat $WAS_SERVER_DIR/profiles/$WAS_PROFILE/config/cells/$WAS_CELL/resources.xml | sed \"$ejbResourceXmlStart,$resourceFileSize!d\" | grep '</propertySet>' -n | cut -d ':' -f1 | head -n 1")
let "ejbResourceXmlEnd=$(echo $ejbResourceXmlEnd) + $(echo $ejbResourceXmlStart)"
local EJB_CONGIF_FULL_FROM_RESOURCE_XML=$(ssh $WAS_HOST_USER@$WAS_HOST "cat $WAS_SERVER_DIR/profiles/$WAS_PROFILE/config/cells/$WAS_CELL/resources.xml | sed \"$ejbResourceXmlStart,$ejbResourceXmlEnd!d\" | sed 's/ //g' ")
fi
local err_values=0;
local ok_values=0;
local addEJBCustomPropertyValues=();
local removeEJBCustomPropertyValues=();
local editEJBCustomPorpertyValues=();
for i in $(echo "$EJB_CONGIF_FULL_FROM_RESOURCE_XML" | grep 'resourceProperties')
do
local remoteValue=$( echo "$i" | sed 's/value="/#/'| cut -d"#" -f2 | cut -d"\"" -f1)
local remoteName=$(echo "$i" | sed 's/name="/#/'| cut -d"#" -f2 | cut -d"\"" -f1)
local localValue=$( cat $tmpFile | grep $remoteName | cut -d"|" -f4)
if [ "$1" == "portal" ]
then
local correctedLocalValue=$(echo "$localValue"| sed "s#$LOCAL_EJB_URL#$REMOTE_EJB_URL_PORTAL#g")
else
local correctedLocalValue=$(echo "$localValue"| sed "s#$LOCAL_EJB_URL#$REMOTE_EJB_URL_WAS#g")
fi
#echo "-$correctedRemoteValue-"
if [[ "$remoteValue" == "$correctedLocalValue" ]]
then
#echo -e "$BLUE Hodnoty sa zhoduju $NC"
let "ok_values=$ok_values + 1"
else
echo "Name: $remoteName"
echo "Value Local: -$correctedLocalValue-"
echo "Value Remote: -$remoteValue-"
if [ "$localValue" == "" ]
then
removeEJBCustomPropertyValues=("${removeEJBCustomPropertyValues[@]}" "$remoteName")
echo -e "$RED Hodnota je nepotrebna $NC"
else
editEJBCustomPorpertyValues=("${editEJBCustomPorpertyValues[@]}" "$remoteName")
echo -e "$RED Hodnoty sa nezhoduju $NC"
fi
let "err_values=$err_values + 1"
fi
done
for i in $(cat $tmpFile |sed 's/ //g')
do
local localName=$( echo $i | cut -d"|" -f3)
local localValue=$( echo $i | cut -d"|" -f4)
local remoteValue=$( echo "$EJB_CONGIF_FULL_FROM_RESOURCE_XML" | grep "$localName" | sed 's/value="/#/'| cut -d"#" -f2 | cut -d"\"" -f1)
if [ "$1" == "portal" ]
then
local correctedRemoteValue=$(echo "$remoteValue"| sed "s#$REMOTE_EJB_URL_PORTAL#$LOCAL_EJB_URL#g")
else
local correctedRemoteValue=$(echo "$remoteValue"| sed "s#$REMOTE_EJB_URL_WAS#$LOCAL_EJB_URL#g")
fi
#echo "-$correctedRemoteValue-"
if [[ "$localValue" != "$correctedRemoteValue" ]]
then
if [ "$correctedRemoteValue" == "" ]
then
echo "Name Local: $localName"
echo "Value Local: $localValue"
echo "Value Remote: $remoteValue"
addEJBCustomPropertyValues=("${addEJBCustomPropertyValues[@]}" "$localName")
echo -e "$RED Hodnota je nevyplnena $NC"
let "err_values=$err_values + 1"
fi
fi
done
echo
echo
echo "Statistics WAS EJB: "
echo -e "EJB v poriadku:$BLUE $ok_values $NC"
echo -e "Nekompatibilne EJB:$RED $err_values $NC"
echo
echo
echo "1. Pridanie EJBconfigov 2. Odstranenie EJBconfigov"
echo "3. Uprava zmien v EJBconfigoch "
echo " 0. back"
echo " 00. exit"
echo -n "Vyber moznost: "
read -n1 ejbSubMenuOption
case $ejbSubMenuOption in
1 ) addEJBCustomProperty addEJBCustomPropertyValues[@] $1; ;;
2 ) removeEJBCustomProperty removeEJBCustomPropertyValues[@] $1 ;;
3 ) updateEJBCustomProperty editEJBCustomPorpertyValues[@] $1; ;;
0) clear; ejbMenu ;;
00) clear; exit ;;
"") ;;
*) clear; echo "Chybne zadany vstup"; sleep 1; ejbMenu ;;
esac
}
findJ2EEResourcePorpertyWAS(){
let LINE_NUM=$(ssh $WAS_HOST_USER@$WAS_HOST "cat $WAS_SERVER_DIR/profiles/$WAS_PROFILE/config/cells/$WAS_CELL/resources.xml | grep 'RemoteEJBLocatorReference' -n | cut -d ':' -f1")
let "LINE_NUM_1=$(echo $LINE_NUM) +1"
J2EE_ENV_ENTRY=$(ssh $WAS_HOST_USER@$WAS_HOST "cat $WAS_SERVER_DIR/profiles/$WAS_PROFILE/config/cells/$WAS_CELL/resources.xml | sed -n "$(echo $LINE_NUM_1)p" | cut -d'\"' -f2 ")
}
findJ2EEResourcePorpertyPortal(){
let LINE_NUM=$(ssh $PORTAL_HOST_USER@$PORTAL_HOST "cat $WAS_SERVER_DIR/../wp_profile/config/cells/$PORTAL_CELL/resources.xml | grep 'RemoteEJBLocatorReference' -n | cut -d ':' -f1")
let "LINE_NUM_1=$(echo $LINE_NUM) +1"
J2EE_ENV_ENTRY=$(ssh $PORTAL_HOST_USER@$PORTAL_HOST "cat $WAS_SERVER_DIR/../wp_profile/config/cells/$PORTAL_CELL/resources.xml | sed -n "$(echo $LINE_NUM_1)p" | cut -d'\"' -f2 ")
}
createEjbCustomPropFile(){
vi $EJB_CONFIG_WAS_SVN
}
createEjbCustomPropFilePortal(){
vi $EJB_CONFIG_PORTAL_SVN
}
addEJBCustomPropertyWAS(){
findJ2EEResourcePorpertyWAS
declare -a argAry1=("${!1}")
local datum=$(date '+%d-%m-%Y')
for property in "${argAry1[@]}"
do
echo
local actualValue=$(cat $EJB_CONFIG_WAS_SVN |sed 's/ //g' | grep $property | cut -d"|" -f4 | sed "s#$LOCAL_EJB_URL#$REMOTE_EJB_URL_WAS#g")
echo "Pridavam customProperty: $property s value: $actualValue"
echo "Je to v poriadku?(y/N)"
read adder
if [[ $adder == [yY][eE][sS] ]] || [[ $adder == [yY] ]]
then
ssh $WAS_HOST_USER@$WAS_HOST "$WAS_BIN_DIR/wsadmin.sh -lang jython -user $WAS_USER -password $WAS_PASS -c \"AdminConfig.create('J2EEResourceProperty', '(cells/$WAS_CELL|resources.xml#$J2EE_ENV_ENTRY)', '[[name \\\"$property\\\"] [type \\\"java.lang.String\\\"] [description \\\"Added $datum\\\"] [value \\\"$actualValue\\\"] [required \\\"false\\\"]]')\""
fi
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
done
echo -e "$BLUE EJBconfigy boli pridane $NC"
read
}
addEJBCustomPropertyPortal(){
findJ2EEResourcePorpertyPortal
declare -a argAry1=("${!1}")
local datum=$(date '+%d-%m-%Y')
echo "" > tmpJython.py
for property in "${argAry1[@]}"
do
echo
local actualValue=$(cat $EJB_CONFIG_PORTAL_SVN |sed 's/ //g' | grep $property | cut -d"|" -f4 | sed "s#$LOCAL_EJB_URL#$REMOTE_EJB_URL_PORTAL#g")
echo "Pridavam customProperty: $property s value: $actualValue"
echo "Je to v poriadku?(y/N)"
read adder
if [[ $adder == [yY][eE][sS] ]] || [[ $adder == [yY] ]]
then
echo "AdminConfig.create('J2EEResourceProperty', '(cells/$PORTAL_CELL|resources.xml#$J2EE_ENV_ENTRY)', '[[name \"$property\"] [type \"java.lang.String\"] [description \"Added $datum\"] [value \"$actualValue\"] [required \"false\"]]')" >> tmpJython.py
fi
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
done
echo "AdminConfig.save()" >> tmpJython.py
scp tmpJython.py $PORTAL_HOST_USER@$PORTAL_HOST:./
ssh $PORTAL_HOST_USER@$PORTAL_HOST "/opt/IBM/WebSphere/PortalServer/bin/wpscript.sh -lang jython -user $PORTAL_USER -password $PORTAL_PASS -f tmpJython.py "
ssh $PORTAL_HOST_USER@$PORTAL_HOST "rm tmpJython.py"
rm tmpJython.py
echo -e "$BLUE EJBconfigy boli pridane $NC"
read
}
updateEJBCustomPropertyWAS(){
local EJB_CONGIF_FULL_FROM_RESOURCE_XML=$(ssh $WAS_HOST_USER@$WAS_HOST "cat $WAS_SERVER_DIR/profiles/$WAS_PROFILE/config/cells/$WAS_CELL/resources.xml")
local datum=$(date '+%d-%m-%Y')
declare -a argAry1=("${!1}")
for property in "${argAry1[@]}"
do
local remoteValue=$( echo "$EJB_CONGIF_FULL_FROM_RESOURCE_XML" | grep "$property" | sed 's/value="/#/'| cut -d"#" -f2 | cut -d"\"" -f1)
local remoteJ2EEResourceProperty=$( echo "$EJB_CONGIF_FULL_FROM_RESOURCE_XML" | grep "$property" | sed 's/xmi:id="/#/'| cut -d"#" -f2 | cut -d"\"" -f1)
echo
local actualValue=$(cat $EJB_CONFIG_WAS_SVN |sed 's/ //g' | grep $property | cut -d"|" -f4 | sed "s#$LOCAL_EJB_URL#$REMOTE_EJB_URL_WAS#g")
echo "Menim customProperty: $property"
echo "Stara hodnota: -$remoteValue-"
echo "Nova hodnota: -$actualValue-"
echo "Je to v poriadku?(y/N)"
read updater
if [[ $updater == [yY][eE][sS] ]] || [[ $updater == [yY] ]]
then
ssh $WAS_HOST_USER@$WAS_HOST "$WAS_BIN_DIR/wsadmin.sh -lang jython -user $WAS_USER -password $WAS_PASS -c \"AdminConfig.modify('(cells/$WAS_CELL|resources.xml#$remoteJ2EEResourceProperty)', '[[name \\\"$property\\\"] [type \\\"java.lang.String\\\"] [description \\\"Updated $datum\\\"] [value \\\"$actualValue\\\"] [required \\\"false\\\"]]')\""
fi
done
echo -e "$BLUE EJBconfigy boli Upravene $NC"
read
}
updateEJBCustomPropertyPortal(){
local EJB_CONGIF_FULL_FROM_RESOURCE_XML=$(ssh $PORTAL_HOST_USER@$PORTAL_HOST "cat $WAS_SERVER_DIR/../wp_profile/config/cells/$PORTAL_CELL/resources.xml")
local datum=$(date '+%d-%m-%Y')
declare -a argAry1=("${!1}")
echo "" > tmpJython.py
for property in "${argAry1[@]}"
do
local remoteValue=$( echo "$EJB_CONGIF_FULL_FROM_RESOURCE_XML" | grep "$property" | sed 's/value="/#/'| cut -d"#" -f2 | cut -d"\"" -f1)
local remoteJ2EEResourceProperty=$( echo "$EJB_CONGIF_FULL_FROM_RESOURCE_XML" | grep "$property" | sed 's/xmi:id="/#/'| cut -d"#" -f2 | cut -d"\"" -f1)
echo
local actualValue=$(cat $EJB_CONFIG_PORTAL_SVN |sed 's/ //g' | grep $property | cut -d"|" -f4 | sed "s#$LOCAL_EJB_URL#$REMOTE_EJB_URL_PORTAL#g")
echo "Menim customProperty: $property"
echo "Stara hodnota: -$remoteValue-"
echo "Nova hodnota: -$actualValue-"
echo "Je to v poriadku?(y/N)"
read updater
if [[ $updater == [yY][eE][sS] ]] || [[ $updater == [yY] ]]
then
echo "AdminConfig.modify('(cells/$PORTAL_CELL|resources.xml#$remoteJ2EEResourceProperty)', '[[name \"$property\"] [type \"java.lang.String\"] [description \"Updated $datum\"] [value \"$actualValue\"] [required \"false\"]]')" >> tmpJython.py
fi
done
echo "AdminConfig.save()" >> tmpJython.py
scp tmpJython.py $PORTAL_HOST_USER@$PORTAL_HOST:./
ssh $PORTAL_HOST_USER@$PORTAL_HOST "/opt/IBM/WebSphere/PortalServer/bin/wpscript.sh -lang jython -user $PORTAL_USER -password $PORTAL_PASS -f tmpJython.py "
ssh $PORTAL_HOST_USER@$PORTAL_HOST "rm tmpJython.py"
rm tmpJython.py
echo -e "$BLUE EJBconfigy boli upravene $NC"
read
}
removeEJBCustomPropertyWAS(){
local EJB_CONGIF_FULL_FROM_RESOURCE_XML=$(ssh $WAS_HOST_USER@$WAS_HOST "cat $WAS_SERVER_DIR/profiles/$WAS_PROFILE/config/cells/$WAS_CELL/resources.xml")
declare -a argAry1=("${!1}")
for property in "${argAry1[@]}"
do
local remoteValue=$( echo "$EJB_CONGIF_FULL_FROM_RESOURCE_XML" | grep "$property" | sed 's/value="/#/'| cut -d"#" -f2 | cut -d"\"" -f1)
local remoteJ2EEResourceProperty=$( echo "$EJB_CONGIF_FULL_FROM_RESOURCE_XML" | grep "$property" | sed 's/xmi:id="/#/'| cut -d"#" -f2 | cut -d"\"" -f1)
echo
echo "Mazem customProperty: $property"
echo "Stara hodnota: -$remoteValue-"
echo "Je to v poriadku?(y/N)"
read deleter
if [[ $deleter == [yY][eE][sS] ]] || [[ $deleter == [yY] ]]
then
ssh $WAS_HOST_USER@$WAS_HOST "$WAS_BIN_DIR/wsadmin.sh -lang jython -user $WAS_USER -password $WAS_PASS -c \"AdminConfig.remove('(cells/$WAS_CELL|resources.xml#$remoteJ2EEResourceProperty)')\""
fi
done
echo -e "$BLUE EJBconfigy boli Zmazane $NC"
read
}
removeEJBCustomPropertyPortal(){
local EJB_CONGIF_FULL_FROM_RESOURCE_XML=$(ssh $PORTAL_HOST_USER@$PORTAL_HOST "cat $WAS_SERVER_DIR/../wp_profile/config/cells/$PORTAL_CELL/resources.xml")
declare -a argAry1=("${!1}")
echo "" > tmpJython.py
for property in "${argAry1[@]}"
do
local remoteValue=$( echo "$EJB_CONGIF_FULL_FROM_RESOURCE_XML" | grep "$property" | sed 's/value="/#/'| cut -d"#" -f2 | cut -d"\"" -f1)
local remoteJ2EEResourceProperty=$( echo "$EJB_CONGIF_FULL_FROM_RESOURCE_XML" | grep "$property" | sed 's/xmi:id="/#/'| cut -d"#" -f2 | cut -d"\"" -f1)
echo
echo "Mazem customProperty: $property"
echo "Stara hodnota: -$remoteValue-"
echo "Je to v poriadku?(y/N)"
read deleter
if [[ $deleter == [yY][eE][sS] ]] || [[ $deleter == [yY] ]]
then
echo "AdminConfig.remove('(cells/$PORTAL_CELL|resources.xml#$remoteJ2EEResourceProperty)')" >> tmpJython.py
fi
done
echo "AdminConfig.save()" >> tmpJython.py
scp tmpJython.py $PORTAL_HOST_USER@$PORTAL_HOST:./
ssh $PORTAL_HOST_USER@$PORTAL_HOST "/opt/IBM/WebSphere/PortalServer/bin/wpscript.sh -lang jython -user $PORTAL_USER -password $PORTAL_PASS -f tmpJython.py "
ssh $PORTAL_HOST_USER@$PORTAL_HOST "rm tmpJython.py"
rm tmpJython.py
echo -e "$BLUE EJBconfigy boli zmazane $NC"
read
}
addEJBCustomProperty(){
clear
if [ "$2" == "portal" ]
then
addEJBCustomPropertyPortal $1
else
addEJBCustomPropertyWAS $1
fi
}
updateEJBCustomProperty(){
clear
if [ "$2" == "portal" ]
then
updateEJBCustomPropertyPortal $1
else
updateEJBCustomPropertyWAS $1
fi
}
removeEJBCustomProperty(){
clear
if [ "$2" == "portal" ]
then
removeEJBCustomPropertyPortal $1
else
removeEJBCustomPropertyWAS $1
fi
}
sendJars(){
clear
echo -n "Zadajte cestu ku konfiguracnemu suboru na zmazanie a odoslanie .jar suborov: "
read -er filePath
RUN_CONTROL_CONFIG=true;
parseJarConfig $filePath
echo -e "$BLUE Stlac enter pre pokracovanie $NC"
read
}
guiDeploy(){
clear
echo -n "Zadajte cestu ku konfiguracnemu suboru na deploy aplikacie: "
read -er filePath
RUN_CONTROL_CONFIG=true;
deploy $filePath
}
guiDeploy(){
clear
echo -n "Zadajte cestu ku konfiguracnemu suboru na deploy war: "
read -er filePath
RUN_CONTROL_CONFIG=true;
warDeploy $filePath
}
menu(){
clear
echo -e "$BLUE $BOLD Vyberte moznost: $NC
1) Premazanie a odoslanie JAR suborov
2) Kontrola EJB nastaveni
3) Deployment EAR podla konfiguracie
4) Deployment WAR podla konfiguracie
0) Exit
Zadajte volbu: "
read -n1 option
case $option in
1) sendJars ;;
2) ejbMenu ;;
3) guiDeploy ;;
4) guiWarDeploy ;;
0) clear; exit ;;
*) clear;
echo -e "$RED Zle zadana moznost $NC"
menu;
esac
menu
}