Produced by Araxis Merge on 4/11/2017 10:47:23 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | Tue Apr 11 15:47:23 2017 UTC | ||
2 | PS_PPS_Weblogic_Domain\install\domain_template.jar\bin\nodemanager | wlscontrol.sh | Fri Oct 7 07:11:04 2016 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 0 | 0 |
Changed | 0 | 0 |
Inserted | 1 | 1145 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | #!/bin/sh | |||||
2 | # | |||||
3 | # Node man ager shell script ve rsion. | |||||
4 | # | |||||
5 | ||||||
6 | #set -vx | |||||
7 | # | |||||
8 | # Reads a line from the specif ied file a nd returns it in REP LY. | |||||
9 | # Error me ssage supr essed if f ile not fo und. | |||||
10 | # | |||||
11 | read_file( ) | |||||
12 | { | |||||
13 | if [ -f "$1" ]; th en | |||||
14 | read R EPLY 2>$Nu llDevice < "$1" | |||||
15 | else | |||||
16 | return 1 | |||||
17 | fi | |||||
18 | } | |||||
19 | ||||||
20 | # | |||||
21 | # Writes a line to t he specifi ed file. T he line wi ll first b e written | |||||
22 | # to a tem porary fil e which is then used to atomic ally overw rite the | |||||
23 | # destinat ion file. This preve nts a simu ltaneous r ead from g etting | |||||
24 | # partial data. | |||||
25 | # | |||||
26 | write_file () | |||||
27 | { | |||||
28 | file=" $1"; shift | |||||
29 | echo $ * >>$file. tmp | |||||
30 | mv -f "$file.tmp " "$file" | |||||
31 | } | |||||
32 | ||||||
33 | # | |||||
34 | # Updates the state file with new server state inf ormation. | |||||
35 | # | |||||
36 | write_stat e() | |||||
37 | { | |||||
38 | write_ file "$Sta teFile" "$ 1" | |||||
39 | } | |||||
40 | ||||||
41 | # | |||||
42 | # Prints i nformation al message to server output lo g. | |||||
43 | # | |||||
44 | print_info () | |||||
45 | { | |||||
46 | echo " <`date`)> <Info> <No deManager> <"$@">" | |||||
47 | } | |||||
48 | ||||||
49 | # | |||||
50 | # Prints e rror messa ge to serv er output log. | |||||
51 | # | |||||
52 | print_err( ) | |||||
53 | { | |||||
54 | echo " <`date`> < Error> <No deManager> <"$@">" | |||||
55 | } | |||||
56 | ||||||
57 | # | |||||
58 | # Returns true if th e process with the s pecified p id is stil l alive. | |||||
59 | # | |||||
60 | is_alive() | |||||
61 | { | |||||
62 | if [ - d /proc ]; then | |||||
63 | [ -r /proc/$ 1 ] | |||||
64 | else | |||||
65 | ps -p $1 2>$ NullDevice | grep $1 >$NullDev ice 2>&1 | |||||
66 | fi | |||||
67 | } | |||||
68 | ||||||
69 | # | |||||
70 | # BUG17778 020 Scan t he process list to s ee if the specific s erver is r unning | |||||
71 | # | |||||
72 | # PidFile could cont ain stale pid, so | |||||
73 | # Scan all process i ds to exam ine whethe r the serv er is runn ing | |||||
74 | # If the s erver pid was not fo und, then it is not running OR perhaps t he process command l ine is hid den when l isting pro cesses. B etter to e rr on the side of re starting t he server. If the s erver is s till runni ng, then t his restar t attempt will simpl y fail. | |||||
75 | # One opti on to reso lve this i s to detec t when the process c ommand lin e is hidde n and veri fy another way. | |||||
76 | # | |||||
77 | is_server_ running() | |||||
78 | { | |||||
79 | SrvrPi d=`ps -eaf |grep "ja va.*-Dwebl ogic.Name= $ServerNam e.*weblogi c.Server" |grep -v " grep" |awk '{print $ 2}'` | |||||
80 | if [ - z $SrvrPid ]; then | |||||
81 | # no server pid, serve r is NOT r unning | |||||
82 | re turn 1; | |||||
83 | fi | |||||
84 | # dete cted serve r pid, ser ver is run ning | |||||
85 | return 0; | |||||
86 | } | |||||
87 | ||||||
88 | # | |||||
89 | # BUG18083 640 Check the PID of the lockf ile to ens ure it is correct | |||||
90 | # | |||||
91 | # PidFile could cont ain stale pid, so ch eck the de scription of the pro cess | |||||
92 | # to make sure it is the monit or process | |||||
93 | # Maybe de tect when the proces s command line is hi dden and v erify anot her way. | |||||
94 | # | |||||
95 | is_lockfil e_correct( ) { | |||||
96 | if rea d_file "$L ockFile"; then | |||||
97 | ps -eaf |gre p "$REPLY" |grep -v "grep" |gr ep "wlscon trol.sh" > $NullDevi ce 2>&1 | |||||
98 | if [ $? -ne 0 ]; then | |||||
99 | # no wls control pr ocess -loc k file is stale | |||||
100 | return 1 ; | |||||
101 | fi | |||||
102 | fi | |||||
103 | return 0; | |||||
104 | } | |||||
105 | ||||||
106 | # | |||||
107 | # Returns true if th e server s tate file indicates that the s erver has started. | |||||
108 | # | |||||
109 | server_is_ started() | |||||
110 | { | |||||
111 | if rea d_file "$S tateFile"; then | |||||
112 | ca se $REPLY in | |||||
113 | *: Y:*) retur n 0 ;; | |||||
114 | es ac | |||||
115 | fi | |||||
116 | return 1 | |||||
117 | } | |||||
118 | ||||||
119 | # | |||||
120 | # Returns true if th e server s tate file indicates that the s erver has not yet st arted. | |||||
121 | # | |||||
122 | server_not _yet_start ed() | |||||
123 | { | |||||
124 | if ser ver_is_sta rted; then | |||||
125 | retu rn 1; | |||||
126 | else | |||||
127 | retu rn 0; | |||||
128 | fi | |||||
129 | } | |||||
130 | ||||||
131 | # | |||||
132 | # Returns true if th e monitor is running otherwise false. Al so will re move | |||||
133 | # the moni tor lock f ile if it is no long er valid. | |||||
134 | # | |||||
135 | monitor_is _running() | |||||
136 | { | |||||
137 | if rea d_file "$L ockFile" & & is_alive $REPLY; t hen | |||||
138 | re turn 0 | |||||
139 | fi | |||||
140 | rm -f "$LockFile " | |||||
141 | return 1 | |||||
142 | } | |||||
143 | # | |||||
144 | # Get the current ti me as an e quivalent time_t. N ote that t his may no t be | |||||
145 | # always r ight, but should be good enoug h for our purposes o f monitori ng | |||||
146 | # interval s. | |||||
147 | ||||||
148 | time_as_ti met() { | |||||
149 | ||||||
150 | if [ x $BaseYear = x0 ]; th en | |||||
151 | Ba seYear=197 0 | |||||
152 | fi | |||||
153 | cur_ti met=`date -u +"%Y %j %H %M %S" | awk '{ | |||||
154 | ba se_year = 1970 | |||||
155 | ye ar=$1; day =$2; hour= $3; min=$4 ; sec=$5; | |||||
156 | ye arsecs=int ((year - base_year) * 365.25 ) * 86400 | |||||
157 | da ysecs=day * 86400 | |||||
158 | hr secs=hour* 3600 | |||||
159 | mi nsecs=min* 60 | |||||
160 | to tal=yearse cs + dayse cs + hrsec s + minsec s + sec | |||||
161 | pr intf "%08d ", total | |||||
162 | }' ` | |||||
163 | } | |||||
164 | ||||||
165 | # | |||||
166 | # Update t he base st art time i f it is 0. Every ti me a serve r stops, | |||||
167 | # if the t ime since last base time is > restart in terval, it is reset | |||||
168 | # to 0. N ext restar t of the s erver will set the l ast base s tart time | |||||
169 | # to the n ew time | |||||
170 | # | |||||
171 | update_bas e_time() { | |||||
172 | time_a s_timet | |||||
173 | if [ $ LastBaseSt artTime -e q 0 ]; the n | |||||
174 | La stBaseStar tTime=$cur _timet | |||||
175 | fi | |||||
176 | } | |||||
177 | ||||||
178 | # | |||||
179 | # Computes the secon ds elapsed between l ast start time and c urrent tim e | |||||
180 | # | |||||
181 | compute_di ff_time() { | |||||
182 | #get c urrent tim e as time_ t | |||||
183 | time_a s_timet | |||||
184 | diff_t ime=`expr $cur_timet - $LastBa seStartTim e` | |||||
185 | } | |||||
186 | ||||||
187 | # | |||||
188 | # Loads se rver start up propert ies into c urrent env ironment. | |||||
189 | # | |||||
190 | load_prope rties() | |||||
191 | { | |||||
192 | # We h ave to do some compl icated stu ff to make this come into our env. | |||||
193 | tmpfil e="${Props File}.nmtm p" | |||||
194 | rm -f "$tmpfile" | |||||
195 | while read REPLY ; do | |||||
196 | ca se $REPLY in | |||||
197 | *= *) | |||||
198 | name=`echo $REPLY | cut -f1 -d '='` | |||||
199 | value=`ech o $REPLY | cut -f2- -d'='` | |||||
200 | echo ${nam e}=\'${val ue}\' >> $ tmpfile | |||||
201 | ;; | |||||
202 | es ac | |||||
203 | done < $PropsFile | |||||
204 | . "$tm pfile" | |||||
205 | rm -f "$tmpfile" | |||||
206 | } | |||||
207 | ||||||
208 | # | |||||
209 | # Loads se rver start up propert ies from s tandard in put into c urrent | |||||
210 | # environm ent and al so saves t hem to the startup p roperties file. | |||||
211 | # The User name and P assword pr operties w ill be sav ed to the boot | |||||
212 | # identity file inst ead. | |||||
213 | # | |||||
214 | save_prope rties() | |||||
215 | { | |||||
216 | print_ info "Savi ng startup propertie s to '$Pro psFile'" | |||||
217 | rm -f "$PropsFil e.tmp" | |||||
218 | while read REPLY ; do | |||||
219 | ca se $REPLY in | |||||
220 | *= *) | |||||
221 | name=`e cho $REPLY | cut -f1 -d'='` | |||||
222 | value=` echo $REPL Y | cut -f 2- -d'='` | |||||
223 | eval $n ame=\"$val ue\" | |||||
224 | case $n ame in | |||||
225 | Usern ame) ;; | |||||
226 | Passw ord) ;; | |||||
227 | Trust KeyStore) ;; | |||||
228 | Custo mTrustKeyS toreFileNa me) ;; | |||||
229 | Custo mTrustKeyS toreType) ;; | |||||
230 | Custo mTrustKeyS torePassPh rase) ;; | |||||
231 | JavaS tandardTru stKeyStore PassPhrase ) ;; | |||||
232 | *) | |||||
233 | ech o "$name=$ value" >>$ PropsFile. tmp;; | |||||
234 | esac | |||||
235 | es ac | |||||
236 | done | |||||
237 | mv -f "$PropsFil e.tmp" "$P ropsFile" | |||||
238 | if [ - n "$userna me" -a -n "$password " ]; then | |||||
239 | pri nt_info "C reating bo ot identit y file '$N MBootFile' " | |||||
240 | pri nt_info "I nvestigati ng usernam e: '$usern ame' and p assword: ' $password' " | |||||
241 | ech o "usernam e=$usernam e" >"$NMBo otFile.tmp " | |||||
242 | ech o "passwor d=$passwor d" >>"$NMB ootFile.tm p" | |||||
243 | uns et usernam e password | |||||
244 | elif [ -n "$User name" -a - n "$Passwo rd" ]; the n | |||||
245 | pri nt_info "I nvestigati ng Usernam e: '$Usern ame' and P assword: ' $Password' " | |||||
246 | ech o "usernam e=$Usernam e" >"$NMBo otFile.tmp " | |||||
247 | ech o "passwor d=$Passwor d" >>"$NMB ootFile.tm p" | |||||
248 | uns et Usernam e Password | |||||
249 | fi | |||||
250 | if [ - n "$NMBoot File.tmp" ]; then | |||||
251 | if [ -n "$Tr ustKeyStor e" ]; then | |||||
252 | echo "Tru stKeyStore =$TrustKey Store" >>" $NMBootFil e.tmp" | |||||
253 | fi | |||||
254 | if [ -n "$Cu stomTrustK eyStoreFil eName" ]; then | |||||
255 | echo "Cus tomTrustKe yStoreFile Name=$Cust omTrustKey StoreFileN ame" >>"$N MBootFile. tmp" | |||||
256 | fi | |||||
257 | if [ -n "$Cu stomTrustK eyStoreTyp e" ]; then | |||||
258 | echo "Cus tomTrustKe yStoreType =$CustomTr ustKeyStor eType" >>" $NMBootFil e.tmp" | |||||
259 | fi | |||||
260 | if [ -n "$Cu stomTrustK eyStorePas sPhrase" ] ; then | |||||
261 | echo "Cus tomTrustKe yStorePass Phrase=$Cu stomTrustK eyStorePas sPhrase" > >"$NMBootF ile.tmp" | |||||
262 | fi | |||||
263 | if [ -n "$Ja vaStandard TrustKeySt orePassPhr ase" ]; th en | |||||
264 | echo "Jav aStandardT rustKeySto rePassPhra se=$JavaSt andardTrus tKeyStoreP assPhrase" >>"$NMBoo tFile.tmp" | |||||
265 | fi | |||||
266 | mv -f "$NMBo otFile.tmp " "$NMBoot File" | |||||
267 | un set TrustK eyStore Cu stomTrustK eyStoreFil eName | |||||
268 | un set Custom TrustKeySt oreType Cu stomTrustK eyStorePas sPhrase | |||||
269 | un set JavaSt andardTrus tKeyStoreP assPhrase | |||||
270 | fi | |||||
271 | } | |||||
272 | ||||||
273 | # | |||||
274 | # Rotate t he specifi ed log fil e. Rotated log files are named | |||||
275 | # <server- name>.outX XXXX where XXXXX is the curren t log coun t and the | |||||
276 | # highest is the mos t recent. The log co unt starts at 00001 then cycle s | |||||
277 | # again if it reache s 99999. | |||||
278 | # | |||||
279 | save_log() | |||||
280 | { | |||||
281 | # Make sure we a ren't redi recting st dout/stder r to file before we rotate | |||||
282 | exec > >$NullDevi ce 2>&1 | |||||
283 | fileLe n=`echo ${ OutFile} | wc -c` | |||||
284 | fileLe n=`expr ${ fileLen} + 1` | |||||
285 | lastLo g=`ls -r1 "$OutFile" * | head - 1` | |||||
286 | logCou nt=`ls -r1 "$OutFile "* | head -1 | cut - c $fileLen -` | |||||
287 | if [ - z "$logCou nt" ]; the n | |||||
288 | logC ount=0 | |||||
289 | fi | |||||
290 | if [ " $logCount" -eq "9999 9" ]; then | |||||
291 | logC ount=0 | |||||
292 | fi | |||||
293 | logCou nt=`expr $ {logCount} + 1` | |||||
294 | zeroPa ds="" | |||||
295 | case $ logCount i n | |||||
296 | [0-9]) zeroPads= "0000" ;; | |||||
297 | [0-9][ 0-9]) zero Pads="000" ;; | |||||
298 | [0-9][ 0-9][0-9]) zeroPads= "00" ;; | |||||
299 | [0-9][ 0-9][0-9][ 0-9]) zero Pads="0" ; ; | |||||
300 | esac | |||||
301 | rotate dLog="$Out File"$zero Pads$logCo unt | |||||
302 | mv -f "$OutFile" "$rotated Log" | |||||
303 | print_ info "Rota ted server output lo g to '$rot atedLog'" | |||||
304 | } | |||||
305 | ||||||
306 | ||||||
307 | # | |||||
308 | # Returns the comman d line and environme nt that is used when starting a | |||||
309 | # server t hrough the server st art script . | |||||
310 | # | |||||
311 | get_script _environme nt() | |||||
312 | { | |||||
313 | get_ja va_options | |||||
314 | # Envi roment var iable sett ings for s erver star t script. In this ca se, | |||||
315 | # ther e is no wa y to overr ide BEA_HO ME, JAVA_H OME, or th e Java pol icy | |||||
316 | # file , and the remote sta rt class p ath will g et appende d to the d efault | |||||
317 | # clas s path. | |||||
318 | SERVER _NAME=$Ser verName | |||||
319 | [ -n " $ClassPath " ] && EXT _POST_CLAS SPATH=$Cla ssPath | |||||
320 | SERVER _IP=$Serve rIP | |||||
321 | [ -n " $AdminURL" ] && ADMI N_URL=$Adm inURL | |||||
322 | # Scri pt command name and args | |||||
323 | if [ - n "$Custom StartScrip tName" ] ; then | |||||
324 | Com mandName=$ CustomStar tScriptNam e | |||||
325 | else | |||||
326 | # Always use StartWebL ogicScript as we pas s all the necessary | |||||
327 | # informatio n in the e nvironment . StartMa nagedWebLo gic.sh ove rwrites | |||||
328 | # JAVA_OPTIO NS, ADMIN_ URL which will cause failures | |||||
329 | Co mmandName= $StartWebL ogicScript | |||||
330 | fi | |||||
331 | Comman dArgs= | |||||
332 | } | |||||
333 | ||||||
334 | # | |||||
335 | # Returns the comman d line and environme nt that is used when starting a | |||||
336 | # server b y invoking java dire ctly. | |||||
337 | # | |||||
338 | get_java_e nvironment () | |||||
339 | { | |||||
340 | get_ja va_options | |||||
341 | if [ - x "$SetDom ainEnvScri pt" ]; the n | |||||
342 | # setDomainE nv.sh scri pt exists, so call i t to set u p the defa ult | |||||
343 | # environmen t. In this case, the remote st art class path will be | |||||
344 | # appended t o the defa ult class path. | |||||
345 | pr int_info " Run $SetDo mainEnvScr ipt to set up the de fault envi ronment" | |||||
346 | [ -n "$JavaV endor" ] & & JAVA_VEN DOR=$JavaV endor | |||||
347 | [ -n "$Class Path" ] && EXT_POST_ CLASSPATH= $ClassPath | |||||
348 | . "$SetDomai nEnvScript " | |||||
349 | # If we have security policy alr eady set, use it | |||||
350 | if echo $JAV A_OPTIONS | grep Dja va.securit y.policy= > $NullDev ice 2>&1 | |||||
351 | then | |||||
352 | : | |||||
353 | el se | |||||
354 | if [ "x$ SecurityPo licyFile" != x ] ; t hen | |||||
355 | JAVA _OPTIONS=" $JAVA_OPTI ONS -Djava .security. policy=$Se curityPoli cyFile" | |||||
356 | elif [ - f $WL_HOME /server/li b/weblogic .policy ]; then | |||||
357 | JAVA _OPTIONS=" $JAVA_OPTI ONS \ | |||||
358 | -D java.secur ity.policy =$WL_HOME/ server/lib /weblogic. policy" | |||||
359 | fi | |||||
360 | fi | |||||
361 | else | |||||
362 | # No setDoma inEnv.sh s cript avai lable, so set up def ault envir onment | |||||
363 | # ourselves strictly b ased on re mote start propertie s | |||||
364 | pr int_info " No $SetDom ainEnvScri pt script available, set up de fault envi ronment ba sed on rem ote start properties " | |||||
365 | [ -n "$Class Path" ] && CLASSPATH =$ClassPat h | |||||
366 | ||||||
367 | #M odified fo r SHLIB in hpux | |||||
368 | if [ `uname -s` = "HP- UX" ]; the n | |||||
369 | [ -n "$Ja vaLibraryP ath" ] && SHLIB_PATH =$JavaLibr aryPath | |||||
370 | #M odified fo r LIBPATH in AIX | |||||
371 | el if [ `unam e -s` = "A IX" ]; the n | |||||
372 | [ -n "$Ja vaLibraryP ath" ] && LIBPATH=$J avaLibrary Path | |||||
373 | el se | |||||
374 | [ -n "$Ja vaLibraryP ath" ] && LD_LIBRARY _PATH=$Jav aLibraryPa th | |||||
375 | fi | |||||
376 | ||||||
377 | [ -n "$BeaHo me" ] && B EA_HOME=$B eaHome | |||||
378 | JA VA_OPTIONS ="$JAVA_OP TIONS \ | |||||
379 | ${ SecurityPo licyFile+- Djava.secu rity.polic y=$Securit yPolicyFil e}" | |||||
380 | fi | |||||
381 | ||||||
382 | [ -n " $JavaHome" ] && JAVA _HOME=$Jav aHome | |||||
383 | ||||||
384 | # Set command na me and arg uments | |||||
385 | Comman dName=$JAV A_HOME/bin /java | |||||
386 | Comman dArgs="$JA VA_OPTIONS -Dweblogi c.Name=$Se rverName \ | |||||
387 | ${ BEA_HOME+- Dbea.home= $BEA_HOME} \ | |||||
388 | ${ AdminURL+- Dweblogic. management .server=$A dminURL} \ | |||||
389 | we blogic.Ser ver" | |||||
390 | } | |||||
391 | ||||||
392 | get_java_o ptions() | |||||
393 | { | |||||
394 | JAVA_O PTIONS="$A rguments $ SSLArgumen ts \ | |||||
395 | -D weblogic.n odemanager .ServiceEn abled=true " | |||||
396 | echo $ JAVA_OPTIO NS | grep weblogic.s ystem.Boot IdentityFi le > $Null Device 2>& 1 | |||||
397 | if [ $ ? != 0 ] ; then | |||||
398 | if [ -r "$NMB ootFile" ] ; then | |||||
399 | J AVA_OPTION S="$JAVA_O PTIONS \ | |||||
400 | -Dweblogi c.system.B ootIdentit yFile=$Rel NMBootFile " | |||||
401 | eli f [ -r "$B ootFile" ] ; then | |||||
402 | J AVA_OPTION S="$JAVA_O PTIONS \ | |||||
403 | -Dweblogi c.system.B ootIdentit yFile=$Rel BootFile" | |||||
404 | fi | |||||
405 | fi | |||||
406 | } | |||||
407 | ||||||
408 | # | |||||
409 | # Checks t o make sur e the spec ified doma in directo ry is vali d. Also | |||||
410 | # creates necessary server dir ectories f or startin g WLS. | |||||
411 | # | |||||
412 | check_dirs () | |||||
413 | { | |||||
414 | # Make sure doma in directo ry exists and is val id | |||||
415 | if [ ! -d "$Doma inDir" ]; then | |||||
416 | ec ho "Domain directory '$DomainD ir' not fo und. Make sure doma in directo ry exists and is acc essible" > &2 | |||||
417 | re turn 1 | |||||
418 | fi | |||||
419 | if [ ! -f "$Salt File" -a ! -f "$OldS altFile" ] ; then | |||||
420 | ec ho "Domain salt file '$SaltFil e' not fou nd. See W LST help(' nmEnroll') on how to populate the domain directory with node manager in formation" >&2 | |||||
421 | re turn 1 | |||||
422 | fi | |||||
423 | # Make sure nece ssary dire ctories al so exist | |||||
424 | mkdir -p "$Serve rDir/logs" | |||||
425 | mkdir -p "$Serve rDir/secur ity" | |||||
426 | mkdir -p "$Serve rDir/data/ nodemanage r" | |||||
427 | } | |||||
428 | ||||||
429 | # | |||||
430 | # Starts t he WebLogi c server b y calling the server start scr ipt. | |||||
431 | # | |||||
432 | start_serv er_script( ) | |||||
433 | { | |||||
434 | # Get script com mand line and enviro nment | |||||
435 | get_sc ript_envir onment | |||||
436 | ||||||
437 | if [ ! -x "$Comm andName" ] ; then | |||||
438 | pr int_err "S cript not found: $Co mmandName" | |||||
439 | pr int_info " Will attem pt to star t the serv er using J ava comman d line" | |||||
440 | st art_server | |||||
441 | re turn $? | |||||
442 | fi | |||||
443 | ||||||
444 | # If m igratable then add s erver ip | |||||
445 | if [ - n "$Server IP" ]; the n | |||||
446 | pr int_info " Adding IP $ServerIP for migrat able serve r" | |||||
447 | if [ -z "$In terface" ] ; then | |||||
448 | print_er r "Interfa ce not spe cified. Pl ease set " \ | |||||
449 | "Int erface=<yo ur network interface > in wlsco ntrol.sh." | |||||
450 | fi | |||||
451 | wl sifconfig. sh -addif $Interface $ServerIP $NetMask | |||||
452 | fi | |||||
453 | ||||||
454 | print_ info "Star ting WLS w ith comman d line: $C ommandName $CommandA rgs" | |||||
455 | write_ state STAR TING:N:N | |||||
456 | if $Co mmandName $CommandAr gs; then | |||||
457 | pr int_info " Server sta rt script exited" | |||||
458 | else | |||||
459 | pr int_info " Server sta rt exited with non-z ero status ($?)" | |||||
460 | fi | |||||
461 | # If m igratable then remov e server i p | |||||
462 | if [ - n "$Server IP" ]; the n | |||||
463 | pr int_info " Removing i p $ServerI P for migr atable ser ver" | |||||
464 | if [ -z "$In terface" ] ; then | |||||
465 | print_er r "Interfa ce not spe cified. Pl ease set " \ | |||||
466 | "Int erface=<yo ur network interface > in wlsco ntrol.sh." | |||||
467 | fi | |||||
468 | wl sifconfig. sh -remove if $Interf ace $Serve rIP | |||||
469 | fi | |||||
470 | ||||||
471 | if [ - n "$Custom StopScript Name" ]; t hen | |||||
472 | if [ -x "$Cu stomStopSc riptName" ] ; then | |||||
473 | print_in fo "Launch ing post s top script $CustomSt opScriptNa me" | |||||
474 | $CustomS topScriptN ame | |||||
475 | print_in fo "Comple ted $Custo mStopScrip tName with status ($ ?)" | |||||
476 | ||||||
477 | el se | |||||
478 | print_er r "Stop Sc ript not f ound: $Cus tomStopScr iptName" | |||||
479 | fi | |||||
480 | fi | |||||
481 | return 0 | |||||
482 | } | |||||
483 | ||||||
484 | # | |||||
485 | # Starts W ebLogic se rver by ca lling java directly. | |||||
486 | # | |||||
487 | start_serv er() | |||||
488 | { | |||||
489 | # Get java comma nd line an d environm ent | |||||
490 | get_ja va_environ ment | |||||
491 | if [ ! -x "$Comm andName" ] ; then | |||||
492 | pr int_err "J ava execut able not f ound: $Com mandName" | |||||
493 | wr ite_state FAILED_NOT _RESTARTAB LE:N:Y | |||||
494 | re turn 1 | |||||
495 | fi | |||||
496 | # If m igratable then add s erver ip | |||||
497 | if [ - n "$Server IP" ]; the n | |||||
498 | pr int_info " Adding IP $ServerIP for migrat able serve r" | |||||
499 | if [ -z "$In terface" ] ; then | |||||
500 | print_er r "Interfa ce not spe cified. Pl ease set " \ | |||||
501 | "Int erface=<yo ur network interface > in wlsco ntrol.sh." | |||||
502 | fi | |||||
503 | wl sifconfig. sh -addif $Interface $ServerIP $NetMask | |||||
504 | fi | |||||
505 | # Prin t server s tart comma nd | |||||
506 | print_ info "Star ting WLS w ith comman d line: $C ommandName $CommandA rgs" | |||||
507 | print_ info "CLAS SPATH = ${ CLASSPATH- ?}" | |||||
508 | #modif ied for HP UX & AIX | |||||
509 | ||||||
510 | if [ `uname -s` = "HP-UX" ]; then | |||||
511 | ||||||
512 | pr int_info " SHLIB_PATH =${SHLIB_ PATH-?}" | |||||
513 | el if [ `unam e -s` = "A IX" ]; the n | |||||
514 | ||||||
515 | pr int_info " LIBPATH =$ {LIBPATH-? }" | |||||
516 | ||||||
517 | else | |||||
518 | pr int_info " LD_LIBRARY _PATH = ${ LD_LIBRARY _PATH-?}" | |||||
519 | ||||||
520 | fi | |||||
521 | ||||||
522 | ||||||
523 | print_ info "JAVA _HOME = ${ JAVA_HOME- ?}" | |||||
524 | print_ info "JAVA _VENDOR = ${JAVA_VEN DOR-?}" | |||||
525 | # Set initial se rver state | |||||
526 | write_ state STAR TING:N:N | |||||
527 | # Star t the serv er process | |||||
528 | if $Co mmandName $CommandAr gs; then | |||||
529 | pr int_info " Server pro cess exite d" | |||||
530 | else | |||||
531 | Se rverExitSt atus=$? | |||||
532 | pr int_info " Server pro cess exite d with non -zero stat us ($Serve rExitStatu s)" | |||||
533 | fi | |||||
534 | # If m igratable then remov e server i p | |||||
535 | if [ - n "$Server IP" ]; the n | |||||
536 | pr int_info " Removing i p $ServerI P for migr atable ser ver" | |||||
537 | if [ -z "$In terface" ] ; then | |||||
538 | print_er r "Interfa ce not spe cified. Pl ease set " \ | |||||
539 | "Int erface=<yo ur network interface > in wlsco ntrol.sh." | |||||
540 | fi | |||||
541 | wl sifconfig. sh -remove if $Interf ace $Serve rIP | |||||
542 | fi | |||||
543 | if [ - n "$Custom StopScript Name" ]; t hen | |||||
544 | if [ -x "$Cu stomStopSc riptName" ] ; then | |||||
545 | print_in fo "Launch ing post s top script $CustomSt opScriptNa me" | |||||
546 | $CustomS topScriptN ame | |||||
547 | print_in fo "Comple ted $Custo mStopScrip tName with status ($ ?)" | |||||
548 | el se | |||||
549 | print_er r "Stop Sc ript not f ound: $Cus tomStopScr iptName" | |||||
550 | fi | |||||
551 | fi | |||||
552 | return 0 | |||||
553 | } | |||||
554 | ||||||
555 | start_and_ monitor_se rver() | |||||
556 | { | |||||
557 | trap " rm -f $Loc kFile" 0 | |||||
558 | # Star t server a nd monitor loop | |||||
559 | count= 0 | |||||
560 | while true; do | |||||
561 | # Save previ ous server output lo g | |||||
562 | [ -f "$OutFi le" ] && s ave_log | |||||
563 | # Disconnect input and redirect stdout/std err to ser ver output log | |||||
564 | ex ec 0<$Null Device | |||||
565 | [ -z "$Debug " ] && exe c >>$OutFi le 2>&1 | |||||
566 | co unt=`expr ${count} + 1` | |||||
567 | up date_base_ time | |||||
568 | if [ "x$Star tScriptEna bled" = xt rue ]; the n | |||||
569 | start_se rver_scrip t | |||||
570 | el se | |||||
571 | start_se rver | |||||
572 | fi | |||||
573 | re ad_file "$ StateFile" | |||||
574 | ca se $REPLY in | |||||
575 | *:N:*) print_err "Server st artup fail ed (will n ot be rest arted)" | |||||
576 | wr ite_state FAILED_NOT _RESTARTAB LE:N:Y | |||||
577 | re turn 1 | |||||
578 | ;; | |||||
579 | SHUTTING _DOWN:*:N |\ | |||||
580 | FORCE_SH UTTING_DOW N:*:N) | |||||
581 | pr int_info " Server was shut down normally" | |||||
582 | wr ite_state SHUTDOWN:Y :N | |||||
583 | re turn 0 | |||||
584 | ;; | |||||
585 | esac | |||||
586 | co mpute_diff _time | |||||
587 | if [ $diff_t ime -gt $R estartInte rval ] | |||||
588 | th en | |||||
589 | #Reset c ount | |||||
590 | #bug9732 615 - need to set to 1 so that we don't restart an extra | |||||
591 | #time. | |||||
592 | count=1 | |||||
593 | LastBase StartTime= 0 | |||||
594 | fi | |||||
595 | if [ $AutoRe start != t rue ]; the n | |||||
596 | print_er r "Server failed but is not re startable because au to "\ | |||||
597 | "restart is disabl ed." | |||||
598 | write_st ate FAILED _NOT_RESTA RTABLE:Y:N | |||||
599 | retu rn 1 | |||||
600 | el if [ $coun t -gt $Res tartMax ]; then | |||||
601 | print_er r "Server failed but is not re startable because th e "\ | |||||
602 | "maximum number of restart a ttempts ha s been exc eeded" | |||||
603 | write_st ate FAILED _NOT_RESTA RTABLE:Y:N | |||||
604 | retu rn 1 | |||||
605 | fi | |||||
606 | pr int_info " Server fai led so att empting to restart" | |||||
607 | # Option ally sleep for Resta rtDelaySec onds secon ds before restarting | |||||
608 | if [ $Re startDelay Seconds -g t 0 ]; the n | |||||
609 | writ e_state FA ILED:Y:Y | |||||
610 | slee p $Restart DelaySecon ds | |||||
611 | fi | |||||
612 | done | |||||
613 | } | |||||
614 | ||||||
615 | # | |||||
616 | # Process node manag er START c ommand. St arts serve r with cur rent start up | |||||
617 | # properti es and ent ers the mo nitor loop which wil l automati cally rest art | |||||
618 | # the serv er when it fails. | |||||
619 | # | |||||
620 | do_start() | |||||
621 | { | |||||
622 | # Make sure serv er is not already st arted | |||||
623 | if mon itor_is_ru nning; the n | |||||
624 | if is_lockfi le_correct ; then | |||||
625 | echo "We bLogic Ser ver '$Serv erName' is either al ready runn ing or in the proces s of start ing/restar ting" >&2 | |||||
626 | return 1 | |||||
627 | fi | |||||
628 | fi | |||||
629 | # If m onitor is not runnin g, but if we can det ermine tha t the WLS | |||||
630 | # proc ess is run ning, then say that server is already ru nning. | |||||
631 | # NOTE : this wou ld be very strange t o have a v alid PidFi le but no | |||||
632 | # moni tor proces s to write the pid | |||||
633 | if rea d_file "$P idFile" && is_alive $REPLY; th en | |||||
634 | if is_server _running; then | |||||
635 | echo "We bLogic Ser ver '$Serv erName' is either al ready runn ing or in the proces s of start ing/restar ting" >&2 | |||||
636 | return 1 | |||||
637 | fi | |||||
638 | fi | |||||
639 | ||||||
640 | # Remo ve previou s state fi le | |||||
641 | rm -f "$StateFil e" | |||||
642 | # Chan ge to serv er root di rectory | |||||
643 | cd "$D omainDir" | |||||
644 | # Now start the server and monitor l oop | |||||
645 | start_ and_monito r_server & | |||||
646 | # Crea te server lock file | |||||
647 | write_ file "$Loc kFile" $! | |||||
648 | # Wait for serve r to start up | |||||
649 | while is_alive $! && serv er_not_yet _started; do | |||||
650 | sl eep 1 | |||||
651 | done | |||||
652 | if se rver_not_y et_started ; then | |||||
653 | ec ho "Server failed to start (se e server o utput log for detail s)" >&2 | |||||
654 | re turn 1 | |||||
655 | fi | |||||
656 | return 0 | |||||
657 | } | |||||
658 | ||||||
659 | # | |||||
660 | # Process node manag er KILL co mmand to k ill the cu rrently ru nning serv er. | |||||
661 | # Returns true if su ccessful o therwise r eturns fal se if the server pro cess | |||||
662 | # was not running or could not be killed . | |||||
663 | # | |||||
664 | do_kill() | |||||
665 | { | |||||
666 | # Chec k for pid file | |||||
667 | read_f ile "$PidF ile" | |||||
668 | ||||||
669 | if [ " $?" = "0" ]; then | |||||
670 | srvr _pid=$REPL Y | |||||
671 | fi | |||||
672 | ||||||
673 | # Make sure serv er is star ted | |||||
674 | monito r_is_runni ng | |||||
675 | ||||||
676 | if [ " $?" != "0" -a x$srvr _pid = x ] ; then | |||||
677 | ec ho "WebLog ic Server '$ServerNa me' is not currently running" >&2 | |||||
678 | re turn 1 | |||||
679 | fi | |||||
680 | ||||||
681 | # Chec k for pid file | |||||
682 | if [ x $srvr_pid = x ]; the n | |||||
683 | echo "Could no t kill ser ver proces s (pid fil e not foun d). Make sure that the nodema nager nati ve library is suppor ted on the platform and can be loaded us ing the li brary path specified for the s erver" >&2 | |||||
684 | retu rn 1 | |||||
685 | fi | |||||
686 | # Kill the serve r process | |||||
687 | kill $ srvr_pid | |||||
688 | # Now wait for u p to 10 se conds for monitor to die | |||||
689 | count= 0 | |||||
690 | while [ $count - lt 10 ] && monitor_i s_running; do | |||||
691 | slee p 1 | |||||
692 | coun t=`expr ${ count} + 1 ` | |||||
693 | done | |||||
694 | if mon itor_is_ru nning; the n | |||||
695 | echo "Server p rocess did not termi nate in 10 seconds a fter being signaled to termina te" 2>&1 | |||||
696 | retu rn 1 | |||||
697 | fi | |||||
698 | } | |||||
699 | ||||||
700 | do_command () | |||||
701 | { | |||||
702 | case $ NMCMD in | |||||
703 | START) check_di rs | |||||
704 | [ -r "$P ropsFile" ] && load_ properties | |||||
705 | do_start | |||||
706 | ;; | |||||
707 | STARTP ) check_di rs | |||||
708 | save_pro perties | |||||
709 | do_start | |||||
710 | ;; | |||||
711 | STAT) do_stat | |||||
712 | ;; | |||||
713 | EXECSC RIPT) do_e xecute_scr ipt ;; | |||||
714 | ||||||
715 | # Handl ed differe ntly | |||||
716 | # GETST ATES) do _getstates | |||||
717 | # ;; | |||||
718 | # VERS* ) echo "$ FullVersio n" ;; | |||||
719 | # | |||||
720 | KILL) do_kill ;; | |||||
721 | GETLOG ) cat "$Ou tFile" 2>$ NullDevice ;; | |||||
722 | GETNML OG) echo " GETNMLOG n ot applica ble for sc ript based nodemanag er" >&2 ;; | |||||
723 | *) echo "Un recognized command: $1" >&2 ;; | |||||
724 | esac | |||||
725 | } | |||||
726 | ||||||
727 | do_execute _script() | |||||
728 | { | |||||
729 | if [ -z "$ ExecuteScr iptPath" ] ; then | |||||
730 | print_e rr "Script path not provided" 2>&1 | |||||
731 | exit -1 00 | |||||
732 | fi | |||||
733 | ||||||
734 | StartDir=$ CWD | |||||
735 | cd $Migrat ionScriptD ir | |||||
736 | if [ ! -f $ExecuteSc riptPath ] ; then | |||||
737 | print_ err "Unabl e to find file $Exec uteScriptP ath in the correct s ervice mig ration scr ipt direct ory $Migra tionScript Dir." 2>&1 | |||||
738 | exit 1 | |||||
739 | fi | |||||
740 | ||||||
741 | $ExecuteSc riptPath | |||||
742 | ExitCode=$ ? | |||||
743 | ||||||
744 | if [ $Exit Code != 0 ]; then | |||||
745 | print_err "The scri pt '$Execu teScriptPa th' failed with exit code '$Ex itCode'" | |||||
746 | exit $Exi tCode | |||||
747 | fi | |||||
748 | cd $StartD ir | |||||
749 | ||||||
750 | } | |||||
751 | ||||||
752 | ||||||
753 | do_stat() | |||||
754 | { | |||||
755 | valid_ state=0 | |||||
756 | ||||||
757 | if rea d_file "$S tateFile"; then | |||||
758 | stat estr=$REPL Y | |||||
759 | stat e=`echo $R EPLY| sed 's/_ON_ABO RTED_START UP//g'` | |||||
760 | stat e=`echo $s tate | sed 's/:.//g' ` | |||||
761 | else | |||||
762 | stat estr=UNKNO WN:N:N | |||||
763 | stat e=UNKNOWN | |||||
764 | fi | |||||
765 | ||||||
766 | if mon itor_is_ru nning; the n | |||||
767 | vali d_state=1 | |||||
768 | elif r ead_file " $PidFile" && is_aliv e $REPLY; then | |||||
769 | vali d_state=1 | |||||
770 | fi | |||||
771 | ||||||
772 | cleanu p=N | |||||
773 | ||||||
774 | if [ $ valid_stat e = 0 ]; t hen | |||||
775 | cas e $statest r in | |||||
776 | S HUTTING_DO WN:*:N |\ | |||||
777 | F ORCE_SHUTT ING_DOWN:* :N) | |||||
778 | state=SHU TDOWN | |||||
779 | write_sta te $state: Y:N | |||||
780 | ;; | |||||
781 | * UNKNOWN*) | |||||
782 | ;; | |||||
783 | * SHUT*) | |||||
784 | ;; | |||||
785 | * FAIL*) | |||||
786 | ;; | |||||
787 | * :Y:*) | |||||
788 | state=FAI LED_NOT_RE STARTABLE | |||||
789 | cleanup=Y | |||||
790 | ;; | |||||
791 | * :N:*) | |||||
792 | state=FAI LED_NOT_RE STARTABLE | |||||
793 | cleanup=Y | |||||
794 | ;; | |||||
795 | esa c | |||||
796 | ||||||
797 | if [ $cleanup = Y ]; th en | |||||
798 | [ -r "$Pro psFile" ] && load_pr operties | |||||
799 | # cleanup should not be done i n a get st ate functi on, becaus e it is | |||||
800 | # repeated ly called, and can b e done ove r and over if state files | |||||
801 | # are left around af ter migrat ion. Clea nup should be a sepa rate call. | |||||
802 | ||||||
803 | # NOTE | |||||
804 | # keeping the logic with the w ritten sta te - maybe cleanup s hould | |||||
805 | # be renam ed | |||||
806 | if server_ is_started ; then | |||||
807 | write_st ate $state :Y:N | |||||
808 | else | |||||
809 | write_st ate $state :N:N | |||||
810 | fi | |||||
811 | fi | |||||
812 | fi | |||||
813 | ||||||
814 | if [ x$Internal StatCall = xY ]; | |||||
815 | then | |||||
816 | Ser verState=$ state | |||||
817 | else | |||||
818 | ech o $state | |||||
819 | fi | |||||
820 | } | |||||
821 | ||||||
822 | do_getstat es() | |||||
823 | { | |||||
824 | ||||||
825 | Intern alStatCall =Y | |||||
826 | result ="" | |||||
827 | if [ - d $Domain Dir/server s ]; then | |||||
828 | for i in `ls $ DomainDir/ servers` | |||||
829 | do | |||||
830 | ||||||
831 | Se rverName=` expr //$i : '.*/\(.* \)'` | |||||
832 | if [ -d $Dom ainDir/ser vers/$Serv erName/dat a/nodemana ger ]; the n | |||||
833 | ServerDir= $DomainDir /servers/$ ServerName | |||||
834 | StateFile= $ServerDir /data/node manager/$S erverName. state | |||||
835 | PidFile=$S erverDir/d ata/nodema nager/$Ser verName.pi d | |||||
836 | LockFile=$ ServerDir/ data/nodem anager/$Se rverName.l ck | |||||
837 | PropsFile= $ServerDir /data/node manager/st artup.prop erties | |||||
838 | do_stat | |||||
839 | srvr_state =$ServerSt ate | |||||
840 | result="${ result}${S erverName} =${state} " | |||||
841 | fi | |||||
842 | done | |||||
843 | fi | |||||
844 | Intern alStatCall =N | |||||
845 | echo $ result | |||||
846 | } | |||||
847 | ||||||
848 | build_wlsc ontrol() | |||||
849 | { | |||||
850 | if [ ! -z "$Debu g" ]; then | |||||
851 | WLSC ontrol="$W LSControl -v" | |||||
852 | fi | |||||
853 | if [ - n "$StartS criptEnabl ed" ]; the n | |||||
854 | WLSC ontrol="$W LSControl -c" | |||||
855 | fi | |||||
856 | if [ - n "$Custom StartScrip tName" ]; then | |||||
857 | WLSC ontrol="$W LSControl -f $Custom StartScrip tName" | |||||
858 | fi | |||||
859 | if [ - n "$Custom StopScript Name" ]; t hen | |||||
860 | WLSC ontrol="$W LSControl -p $Custom StopScript Name" | |||||
861 | fi | |||||
862 | } | |||||
863 | ||||||
864 | ||||||
865 | do_crashre covery_all domains() | |||||
866 | { | |||||
867 | Domain s=`cut -f1 -s -d'=' $NodeManag erHome/nod emanager.d omains` | |||||
868 | for do main in $D omains; do | |||||
869 | Doma inName=$do main | |||||
870 | WLSC ontrol="wl scontrol.s h -n $Node ManagerHom e -d $Doma inName" | |||||
871 | buil d_wlscontr ol | |||||
872 | $WLS Control CR ASHRECOVER Y & | |||||
873 | done | |||||
874 | } | |||||
875 | ||||||
876 | do_crashre covery() | |||||
877 | { | |||||
878 | WLSCon trol="wlsc ontrol.sh -n $NodeMa nagerHome -r $Domain Dir -d $Do mainName" | |||||
879 | build_ wlscontrol | |||||
880 | if [ - d $DomainD ir/servers ]; then | |||||
881 | for i in `ls $ DomainDir/ servers` | |||||
882 | do | |||||
883 | Se rverName=` expr //$i : '.*/\(.* \)'` | |||||
884 | Se rverDir=$D omainDir/s ervers/$Se rverName | |||||
885 | if [ -d $Ser verDir/dat a/nodemana ger ]; the n | |||||
886 | LockFile=$ ServerDir/ data/nodem anager/$Se rverName.l ck | |||||
887 | if read_fi le "$LockF ile"; then | |||||
888 | if ! i s_server_r unning; th en | |||||
889 | if [ -n $Loc kFile -a - f $LockFil e ]; then | |||||
890 | rm -f "$ LockFile" | |||||
891 | fi | |||||
892 | if [ -n $Pid File -a -f $PidFile ]; then | |||||
893 | rm -f "$ PidFile" | |||||
894 | fi | |||||
895 | $WL SControl - s $ServerN ame START & | |||||
896 | else | |||||
897 | # check nm m onitor pro cess to en sure wls i s monitore d | |||||
898 | ||||||
899 | mo nitorProc= `ps $REPLY ` | |||||
900 | mo nitorProcN ame="wlsco ntrol" | |||||
901 | if ! echo "$ monitorPro c" |grep $ monitorPro cName > $N ullDevice 2>&1; then | |||||
902 | print_er r "Server $ServerNam e is not m onitored b y the Node Manager" | |||||
903 | fi | |||||
904 | fi | |||||
905 | fi | |||||
906 | fi | |||||
907 | done | |||||
908 | fi | |||||
909 | } | |||||
910 | ||||||
911 | # | |||||
912 | # Prints c ommand usa ge message . | |||||
913 | # | |||||
914 | print_usag e() | |||||
915 | { | |||||
916 | cat << EOF | |||||
917 | Usage: wls control [O PTIONS] CM D | |||||
918 | Where opti ons includ e: | |||||
919 | -n nmdir Sets th e node man ager direc tory (defa ult $PWD) | |||||
920 | -s serve r Sets th e server n ame (defau lt myserve r) | |||||
921 | -d domai n Sets th e domain n ame (defau lt mydomai n) | |||||
922 | -r rootd ir Sets th e server r oot direct ory | |||||
923 | -c Use sta rt scripts to start servers | |||||
924 | -f scrip t Full pa th to scri pt to use for -c opt ion (defau lt startWe bLogic.sh) | |||||
925 | -p scrip t Post st op script to run if any after a server s tops | |||||
926 | -v Enable verbose ou tput | |||||
927 | -h Prints this help message | |||||
928 | EOF | |||||
929 | } | |||||
930 | ||||||
931 | ||||||
932 | # Default settings | |||||
933 | # Default NM Home | |||||
934 | WL_HOME="@ WL_HOME" | |||||
935 | NodeManage rHome="${W L_HOME}/co mmon/nodem anager" | |||||
936 | if [ ! -d $NodeManag erHome ] ; then | |||||
937 | NodeMan agerHome=$ PWD | |||||
938 | fi | |||||
939 | if [ -d ${ WL_HOME}/c ommon/bin ] ; then | |||||
940 | PATH=$P ATH:${WL_H OME}/commo n/bin | |||||
941 | fi | |||||
942 | ||||||
943 | FullVersio n="NodeMan ager versi on 12.1" | |||||
944 | DomainDir= | |||||
945 | DomainName = | |||||
946 | ServerName = | |||||
947 | AutoRestar t=true | |||||
948 | RestartMax =2 | |||||
949 | RestartDel aySeconds= 0 | |||||
950 | StartScrip tEnabled= | |||||
951 | CustomStar tScriptNam e= | |||||
952 | CustomStop ScriptName = | |||||
953 | ExecuteScr iptPath= | |||||
954 | LastBaseSt artTime=0 | |||||
955 | NullDevice =/dev/null | |||||
956 | ||||||
957 | # The name of the in terface th at you are using for the addre sses must | |||||
958 | # be confi gured here . | |||||
959 | # | |||||
960 | # Optional ly the Net Mask can b e specifie d, except on Windows platforms where it | |||||
961 | # is requi red for ne tsh and on Linux pla tforms whe re its abs ence can c rash | |||||
962 | # the mach ine | |||||
963 | Interface= ${WLS_Inte rface:-""} | |||||
964 | NetMask=${ WLS_NetMas k:-""} | |||||
965 | # Set the UseMACBroa dcast attr ibute to " true" in o rder to ha ve arping use | |||||
966 | # MAC leve l broadcas ting. arp ing is cal led after binding IP addresses | |||||
967 | # on Linux systems. | |||||
968 | UseMACBroa dcast=${WL S_UseMACBr oadcast:-" false"} | |||||
969 | ||||||
970 | # Exit on any errors | |||||
971 | ##set -e i s commente d out beca use it is too strict with bour ne shell | |||||
972 | ##set -e | |||||
973 | ||||||
974 | # | |||||
975 | # Do the e val dance to get the arguments parsed ri ght. This gets the args | |||||
976 | # that are quoted b ut are sep arate argu ments to e xec to be reassemble d as | |||||
977 | # a single argument. | |||||
978 | # | |||||
979 | eval "set -- $@" | |||||
980 | ||||||
981 | ||||||
982 | # Parse co mmand line options | |||||
983 | while geto pts cd:f:h n:p:r:s:e: v flag "$@ "; do | |||||
984 | case $fl ag in | |||||
985 | n) NodeM anagerHome =$OPTARG ; ; | |||||
986 | s) Serve rName=$OPT ARG ;; | |||||
987 | d) Domai nName=$OPT ARG ;; | |||||
988 | r) Domai nDir=$OPTA RG ;; | |||||
989 | v) Debug =1 ;; | |||||
990 | c) Start ScriptEnab led=true ; ; | |||||
991 | f) Custo mStartScri ptName=$OP TARG ;; | |||||
992 | p) Custo mStopScrip tName=$OPT ARG ;; | |||||
993 | e) Execu teScriptPa th=$OPTARG ;; | |||||
994 | h) print _usage | |||||
995 | exit 0 ;; | |||||
996 | *) echo "Unrecogni zed option : $OPTARG" >&2 | |||||
997 | exit 1 ;; | |||||
998 | esac | |||||
999 | done | |||||
1000 | ||||||
1001 | cygwin=no | |||||
1002 | uname=`una me -s` | |||||
1003 | case $unam e in | |||||
1004 | CYGWIN* ) NullDevi ce=nul | |||||
1005 | cygwin=y es;; | |||||
1006 | *) ;; | |||||
1007 | esac | |||||
1008 | ||||||
1009 | if [ ${OPT IND} -gt 1 ]; then | |||||
1010 | shift `e xpr ${OPTI ND} - 1` | |||||
1011 | fi | |||||
1012 | ||||||
1013 | if [ $# -l t 1 ]; the n | |||||
1014 | print_us age | |||||
1015 | exit 1 | |||||
1016 | fi | |||||
1017 | ||||||
1018 | #Handle ve rsion requ ests | |||||
1019 | ||||||
1020 | NMCMD=`ech o $1 | tr '[a-z]' '[ A-Z]'` | |||||
1021 | ||||||
1022 | case $NMCM D in | |||||
1023 | VERS*) echo "$F ullVersion " | |||||
1024 | exit 0;; | |||||
1025 | esac | |||||
1026 | ||||||
1027 | ||||||
1028 | if [ $NMCM D = "CRASH RECOVERY" -a -z "$Do mainName" ]; then | |||||
1029 | do_crash recovery_a lldomains | |||||
1030 | exit 0 | |||||
1031 | fi | |||||
1032 | ||||||
1033 | ||||||
1034 | if [ -z "$ DomainName " ]; then | |||||
1035 | print_er r "Domain Name not p rovided" 2 >&1 | |||||
1036 | print_us age | |||||
1037 | exit 1 | |||||
1038 | fi | |||||
1039 | ||||||
1040 | ||||||
1041 | # If no do main direc tory speci fied, then look up d omain name in domain s | |||||
1042 | # file. Ot herwise, d efault to the curren t director y. | |||||
1043 | if [ -z "$ DomainDir" -o "x-" = "x$Domain Dir" ]; th en | |||||
1044 | Domain sFile=$Nod eManagerHo me/nodeman ager.domai ns | |||||
1045 | if [ - f $Domains File ]; th en | |||||
1046 | # we must lo ok for "$D omainName= " | |||||
1047 | # usually af ter a new line, does not conta in other c haracters around it | |||||
1048 | # so we avoi d mistakin g mydom fo r dom (gre p will hap pily grab mydom if | |||||
1049 | # it sees it first...) -w will fail to fi nd mydom=r elativePat h because | |||||
1050 | # it sees "r elativePat h" as a wo rd around mydom= on Linux. | |||||
1051 | Do mainDir=`g rep -s "^$ DomainName =" "$Domai nsFile" | cut -f2 -d '=' 2>$Nul lDevice` | |||||
1052 | if [ $? != 0 - o -z "$Dom ainDir" ]; then | |||||
1053 | Do mainDir=$P WD | |||||
1054 | fi | |||||
1055 | else | |||||
1056 | Doma inDir=$PWD | |||||
1057 | fi | |||||
1058 | fi | |||||
1059 | ||||||
1060 | ||||||
1061 | # Absoluti ze directo ry path | |||||
1062 | DomainDir= `cd "$Doma inDir"; pw d` | |||||
1063 | ||||||
1064 | ||||||
1065 | if [ x$cyg win = xyes ]; then | |||||
1066 | # Figure out what the cygdri ve is actu ally named | |||||
1067 | CYGDRIVE =`mount -p s | tail - 1 | awk '{ print $1}' | sed -e 's%/$%%'` | |||||
1068 | # Conver t /cygdriv e/c to c: | |||||
1069 | DomainDi r=`echo $D omainDir | sed "s;$C YGDRIVE/\( .\)/;\1:/; "` | |||||
1070 | fi | |||||
1071 | ||||||
1072 | case $NMCM D in | |||||
1073 | GETSTA TES) | |||||
1074 | do_getst ates | |||||
1075 | exit 0;; | |||||
1076 | CRASHR ECOVERY) | |||||
1077 | do_crash recovery | |||||
1078 | exit 0;; | |||||
1079 | esac | |||||
1080 | ||||||
1081 | if [ -z "$ ServerName " ]; then | |||||
1082 | print_e rr "Server Name not provided" 2>&1 | |||||
1083 | print_u sage | |||||
1084 | exit 1 | |||||
1085 | fi | |||||
1086 | ||||||
1087 | # | |||||
1088 | #If custom stop scri pt is spec ified and is not abs olute, mak e sure tha t | |||||
1089 | #it is rel ative to t he rootdir /bin direc tory. | |||||
1090 | # | |||||
1091 | ||||||
1092 | if [ -n "$ CustomStop ScriptName " ]; then | |||||
1093 | echo x$C ustomStopS criptName | grep '^ x/' > $Nul lDevice 2> &1 | |||||
1094 | if [ $? != 0 ]; th en | |||||
1095 | Custom StopScript Name=$Doma inDir/bin/ $CustomSto pScriptNam e | |||||
1096 | fi | |||||
1097 | fi | |||||
1098 | ||||||
1099 | if [ -n "$ CustomStar tScriptNam e" ]; then | |||||
1100 | echo x$C ustomStart ScriptName | grep ' ^x/' > $Nu llDevice 2 >&1 | |||||
1101 | if [ $? != 0 ]; th en | |||||
1102 | Custom StartScrip tName=$Dom ainDir/bin /$CustomSt artScriptN ame | |||||
1103 | fi | |||||
1104 | fi | |||||
1105 | ||||||
1106 | ||||||
1107 | # Director y and file names | |||||
1108 | ServerDir= $DomainDir /servers/$ ServerName | |||||
1109 | SaltFile=$ DomainDir/ security/S erializedS ystemIni.d at | |||||
1110 | OldSaltFil e=$DomainD ir/Seriali zedSystemI ni.dat | |||||
1111 | StateFile= $ServerDir /data/node manager/$S erverName. state | |||||
1112 | PropsFile= $ServerDir /data/node manager/st artup.prop erties | |||||
1113 | PidFile=$S erverDir/d ata/nodema nager/$Ser verName.pi d | |||||
1114 | LockFile=$ ServerDir/ data/nodem anager/$Se rverName.l ck | |||||
1115 | BootFile=$ ServerDir/ security/b oot.proper ties | |||||
1116 | RelBootFil e=servers/ $ServerNam e/security /boot.prop erties | |||||
1117 | NMBootFile =$ServerDi r/data/nod emanager/b oot.proper ties | |||||
1118 | RelNMBootF ile=server s/$ServerN ame/data/n odemanager /boot.prop erties | |||||
1119 | OutFile=$S erverDir/l ogs/$Serve rName.out | |||||
1120 | SetDomainE nvScript=$ DomainDir/ bin/setDom ainEnv.sh | |||||
1121 | StartWebLo gicScript= $DomainDir /bin/start WebLogic.s h | |||||
1122 | MigrationS criptDir=$ DomainDir/ bin/servic e_migratio n | |||||
1123 | ||||||
1124 | # export n eeded vari ables in o ne place | |||||
1125 | ||||||
1126 | export CLA SSPATH EXT _POST_CLAS SPATH JAVA _OPTIONS L D_LIBRARY_ PATH | |||||
1127 | ||||||
1128 | #modified for hpux a nd AIX | |||||
1129 | ||||||
1130 | if [ `unam e -s` = "H P-UX" ]; t hen | |||||
1131 | export S HLIB_PATH | |||||
1132 | elif [ `un ame -s` = "AIX" ]; t hen | |||||
1133 | export L IBPATH | |||||
1134 | fi | |||||
1135 | ||||||
1136 | ||||||
1137 | export SER VER_NAME S ERVER_IP A DMIN_URL | |||||
1138 | export BEA _HOME WL_H OME JAVA_H OME JAVA_V ENDOR | |||||
1139 | ||||||
1140 | export Int erface Net Mask Domai nName Serv erDir Serv erName Use MACBroadca st | |||||
1141 | export Cus tomStopScr iptName Do mainDir Se rverDir No deManagerH ome | |||||
1142 | export Mig rationScri ptDir Exec uteScriptP ath | |||||
1143 | ||||||
1144 | # Process command | |||||
1145 | do_command |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.