1 # 2 # CDDL HEADER START 3 # 4 # The contents of this file are subject to the terms of the 5 # Common Development and Distribution License (the License). 6 # You may not use this file except in compliance with the License. 7 # 8 # You can obtain a copy of the license at usr/src/CDDL.txt 9 # or http://www.opensolaris.org/os/licensing. 10 # See the License for the specific language governing permissions 11 # and limitations under the License. 12 # 13 # When distributing Covered Code, include this CDDL HEADER in each 14 # file and include the License file at usr/src/CDDL.txt. 15 # If applicable, add the following below this CDDL HEADER, with the 16 # fields enclosed by brackets [] replaced with your own identifying 17 # information: Portions Copyright [yyyy] [name of copyright owner] 18 # 19 # CDDL HEADER END 20 # 21 22 # 23 # Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 # Use is subject to license terms. 25 # 26 # ident "@(#)functions.ksh 1.7 07/06/06 SMI" 27 # 28 29 PKG=SUNWsc9ias 30 MYNAME=`basename $0` 31 MYDIR=`dirname $0` 32 LOGFILE=/var/tmp/${RESOURCE}_logfile 33 LHOSTNAME="LHOSTNAME=${OIAS_LHOST}" 34 SCLOGGER=/usr/cluster/lib/sc/scds_syslog 35 36 syslog_tag() 37 { 38 ${SET_DEBUG} 39 print "SC[${PKG:-??}.${COMPONENT:-??}.${METHOD:-??}]:${RESOURCEGROUP:-??}:${RESOURCE:-??}" 40 } 41 42 scds_syslog() 43 { 44 ${SCLOGGER} "$@" & 45 } 46 47 debug_message() 48 { 49 if [ "${DEBUG}" = "${RESOURCE}" -o "${DEBUG}" = "ALL" ] 50 then 51 SET_DEBUG="set -x" 52 DEBUG_TEXT=${1} 53 54 # SCMSGS 55 # @explanation 56 # Print the message as is. 57 # @user_action 58 # Whenever hadbm fails to even start off, it prints messages first 59 # line starting with "Error:". The messages should be obvious 60 # enough to take corrective action. NOTE: Though the error messages 61 # printed explicitly call out JAVA_HOME, make sure that the 62 # corrective action applies to java in /usr/bin directory. 63 # Unfortunately, our agent is JAVA_HOME ignorant. 64 scds_syslog -p daemon.debug -t $(syslog_tag) -m \ 65 "%s" "${DEBUG_TEXT}" 66 else 67 SET_DEBUG= 68 fi 69 } 70 71 log_message() 72 { 73 debug_message "Function: log_message - Begin" 74 ${SET_DEBUG} 75 76 if [ -s "${LOGFILE}" ] 77 then 78 PRIORITY=${1} 79 HEADER=${2} 80 81 strings ${LOGFILE} > ${LOGFILE}.copy 82 83 while read MSG_TXT 84 do 85 # SCMSGS 86 # @explanation 87 # The first %s refers to the calling program, whereas the 88 # second %s represents the output produced by that program. 89 # Typically, these messages are produced by programs such as 90 # strmqm, endmqm rumqtrm etc. 91 # @user_action 92 # No user action is required if the command was successful. 93 # Otherwise, examine the other syslog messages occurring at 94 # the same time on the same node to see if the cause of the 95 # problem can be identified. 96 scds_syslog -p daemon.${PRIORITY} -t $(syslog_tag) -m \ 97 "%s - %s" \ 98 "${HEADER}" "${MSG_TXT}" 99 done < ${LOGFILE}.copy 100 101 /usr/bin/cat /dev/null > ${LOGFILE} 102 fi 103 104 debug_message "Function: log_message - End" 105 } 106 107 set_redirection() 108 { 109 debug_message "Function: set_redirection - Begin" 110 ${SET_DEBUG} 111 112 if /usr/bin/getent passwd ${OIAS_USER} | /usr/bin/awk -F: '{print $7}' | /usr/xpg4/bin/grep -q csh 113 then 114 OUTPUT=">& ${LOGFILE}" 115 else 116 OUTPUT="> ${LOGFILE} 2>&1" 117 fi 118 119 debug_message "Function: set_redirection - End" 120 } 121 122 validate() 123 { 124 debug_message "Function: validate - Begin" 125 ${SET_DEBUG} 126 127 rc=0 128 129 if [ ! -d "${OIAS_ORAHOME}" ] 130 then 131 # SCMSGS 132 # @explanation 133 # The Oracle E-Business Suite ORACLE_HOME directory does not exist. 134 # @user_action 135 # Check that the correct pathname was entered for the Oracle Home 136 # directory when registering the resource and that the directory 137 # exists. 138 scds_syslog -p daemon.err -t $(syslog_tag) -m \ 139 "Validate - ORACLE_HOME directory %s does not exist" \ 140 "${OIAS_ORAHOME}" 141 rc=1 142 else 143 debug_message "Validate - ORACLE_HOME dir ${OIAS_ORAHOME} exists" 144 fi 145 146 if /usr/bin/cat /etc/passwd | /usr/bin/awk -F: '{print $1}' | /usr/xpg4/bin/grep -q "^${OIAS_USER}$" 147 then 148 debug_message "Validate - Infrastructure user ${OIAS_USER} exists" 149 else 150 # SCMSGS 151 # @explanation 152 # The value of the Oracle Application Server Infratrucure user id 153 # within the xxx_config file is wrong, where xxx_config is either 154 # 9ias_config for Oracle 9iAS or 10gas_config for Oracle 10gAS. 155 # @user_action 156 # Specify the correct OIAS_USER in the appropriate xxx_config file 157 # and reregister xxx_register, where xxx_register is 9ias_register 158 # for Oracle 9iAS or 10gas_register for Oracle 10gAS. 159 scds_syslog -p daemon.err -t $(syslog_tag) -m \ 160 "Validate - Infrastructure user <%s> does not exist" \ 161 "${OIAS_USER}" 162 rc=1 163 fi 164 165 if [ ! -d "${OIAS_INFRA}" ] 166 then 167 # SCMSGS 168 # @explanation 169 # The value of the Oracle Application Server Infrastructure 170 # directory within the xxx_config file is wrong, where xxx_config 171 # is either 9ias_config for Oracle 9iAS or 10gas_config for Oracle 172 # 10gAS. 173 # @user_action 174 # Specify the correct OIAS_INFRA in the appropriate xxx_config 175 # file. 176 scds_syslog -p daemon.err -t $(syslog_tag) -m \ 177 "Validate - Infrastructure directory %s does not exist" \ 178 "${OIAS_INFRA}" 179 rc=1 180 else 181 debug_message "Validate - Infrastructure directory ${OIAS_INFRA} exists" 182 fi 183 184 debug_message "Function: validate - End" 185 return ${rc} 186 } 187 188 check_ias_version() 189 { 190 debug_message "Function: check_ias_version - Begin" 191 ${SET_DEBUG} 192 193 VERSION=`/usr/bin/grep Version= ${OIAS_ORAHOME}/config/ias.properties | /usr/bin/awk -F= '{print $2}'` 194 195 case "${VERSION}" in 196 9.0.4*|10.*) rc_check_ias_version=0 197 ;; 198 *) rc_check_ias_version=1 199 ;; 200 esac 201 202 debug_message "Function: check_ias_version - End" 203 } 204 205 resetiAS_passwd() 206 { 207 debug_message "Function: resetiAS_passwd - Begin" 208 ${SET_DEBUG} 209 210 execute_command resetiASpasswd.sh "cn=orcladmin ${OIAS_ADMIN} ${OIAS_ORAHOME}" 211 212 if [ "${rc_execute_command}" -eq 0 ] 213 then 214 log_message info "resetiAS_passwd" 215 else 216 log_message error "resetiAS_passwd" 217 fi 218 219 debug_message "Function: resetiAS_passwd - End" 220 } 221 222 reregister() 223 { 224 debug_message "Function: reregister - Begin" 225 ${SET_DEBUG} 226 227 PORT=`/usr/bin/grep "Oracle Internet Directory(non-SSL)" ${OIAS_ORAHOME}/install/portlist.ini | /usr/bin/awk -F= '{print $2}'` 228 REREGISTER="/tmp/${RESOURCE}_${RESOURCEGROUP}_reregister.ksh" 229 230 execute_command "${OIAS_ORAHOME}/bin/ldapsearch -h ${OIAS_LHOST} -p ${PORT} -D 'cn=orcladmin' -w '${OIAS_ADMIN}' -b 'cn=IAS Infrastructure Databases,cn=IAS,cn=Products,cn=OracleContext' -s sub 'orclResourceName=orasso'" "orclpasswordattribute" 231 232 OSSOPWD=`/usr/bin/cat ${LOGFILE} | /usr/bin/grep orclpasswordattribute | /usr/bin/awk -F= '{print $2}'` 233 234 REREGISTER="/tmp/${RESOURCE}_${RESOURCEGROUP}_reregister.ksh" 235 236 /usr/bin/cat > ${REREGISTER} <<-EOF 237 #!/bin/ksh 238 239 ${OIAS_ORAHOME}/jdk/bin/java \ 240 -jar ${OIAS_ORAHOME}/sso/lib/ossoreg.jar \ 241 -site_name ${OIAS_ORASID}.${OIAS_FQDN} \ 242 -success_url http://${OIAS_FQDN}:7777/osso_login_success \ 243 -cancel_url http://${OIAS_FQDN}:7777 \ 244 -logout_url http://${OIAS_FQDN}:7777/osso_logout_success \ 245 -home_url http://${OIAS_FQDN}:7777 \ 246 -config_mod_osso TRUE \ 247 -oracle_home_path ${OIAS_ORAHOME} \ 248 -u root \ 249 -apache_server_root ${OIAS_ORAHOME}/Apache/Apache \ 250 -config_file ${OIAS_ORAHOME}/Apache/Apache/conf/osso/osso.conf \ 251 -sso_server_version v1.2 \ 252 -schema orasso \ 253 -pass ${OSSOPWD} 254 EOF 255 256 /bin/chmod 755 ${REREGISTER} 257 /bin/chown ${OIAS_USER} ${REREGISTER} 258 259 execute_command ${REREGISTER} "" 260 261 if [ "${rc_execute_command}" -eq 0 ] 262 then 263 log_message info "reregister" 264 else 265 log_message error "reregister" 266 fi 267 268 debug_message "Function: reregister - End" 269 } 270 271 execute_command() 272 { 273 debug_message "Function: execute_command - Begin" 274 ${SET_DEBUG} 275 276 COMMAND=${1} 277 ARG=${2} 278 279 rc_execute_command=0 280 281 check_ias_version 282 283 if [ "${rc_check_ias_version}" -eq 0 ] 284 then 285 # Logical Host interposing not required for 9.0.4 286 LDP32="" 287 LDP64="" 288 else 289 LDP32="LD_PRELOAD_32=/usr/lib/secure/libschost.so.1" 290 LDP64="LD_PRELOAD_64=/usr/lib/secure/64/libschost.so.1" 291 fi 292 293 LDLP="LD_LIBRARY_PATH=${OIAS_ORAHOME}/lib" 294 OHOME="ORACLE_HOME=${OIAS_ORAHOME}" 295 OSID="ORACLE_SID=${OIAS_ORASID}" 296 RUN_PATH="PATH=${OIAS_ORAHOME}/bin:${PATH}" 297 DISPLAY="DISPLAY=${OIAS_LHOST}:0" 298 299 su ${OIAS_USER} -c "${TASK_COMMAND} env ${LHOSTNAME} env ${LDP32} env ${LDP64} env ${LDLP} env ${OHOME} env ${OSID} env ${RUN_PATH} env ${DISPLAY} ${COMMAND} ${ARG} ${OUTPUT}" > /dev/null 2>&1 300 301 rc_execute_command=$? 302 303 debug_message "Function: execute_command - End" 304 } 305 306 execute_oidmon() 307 { 308 debug_message "Function: execute_oidmon - Begin" 309 ${SET_DEBUG} 310 311 ARG=${1} 312 313 if [ "${ARG}" = "stop" ]; then 314 # Allow oidmon some time to finish processing when stopping 315 sleep 10 316 fi 317 318 execute_command "${OIAS_ORAHOME}/bin/oidmon sleep=5" ${ARG} 319 320 debug_message "Function: execute_oidmon - End" 321 } 322 323 build_sql() 324 { 325 debug_message "Function: build_sql - Begin" 326 ${SET_DEBUG} 327 328 SQLSELECT="/tmp/${RESOURCE}_${RESOURCEGROUP}_SQLSelect.ksh" 329 SQLTRUNCATE="/tmp/${RESOURCE}_${RESOURCEGROUP}_SQLTruncate.ksh" 330 331 /usr/bin/cat > ${SQLSELECT} <<-EOF 332 #!/bin/ksh 333 334 ${OIAS_ORAHOME}/bin/sqlplus -s ods/ods@${OIAS_ORASID} <<-END 335 set echo off verify off termout off feedback off head off 336 select pid from ods.ods_process where configset=0 and instance=1; 337 END 338 339 EOF 340 341 /usr/bin/cat > ${SQLTRUNCATE} <<-EOF 342 #!/bin/ksh 343 344 ${OIAS_ORAHOME}/bin/sqlplus -s ods/ods@${OIAS_ORASID} <<-END 345 set echo off verify off termout off feedback off head off 346 truncate table ods.ods_process; 347 END 348 349 EOF 350 351 /bin/chmod 755 ${SQLSELECT} 352 /bin/chmod 755 ${SQLTRUNCATE} 353 /bin/chown ${OIAS_USER} ${SQLSELECT} 354 /bin/chown ${OIAS_USER} ${SQLTRUNCATE} 355 356 debug_message "Function: build_sql - End" 357 } 358 359 execute_oidldapd() 360 { 361 debug_message "Function: execute_oidldapd - Begin" 362 ${SET_DEBUG} 363 364 # The oidctl utility issues run-server and stop-server commands that are 365 # interpreted and processed by the OID monitor process, via table 366 # ods.ods_process. 367 368 ARG=${1} 369 SAVEARG=${ARG} 370 PID= 371 372 if [ "${ARG}" = "start" ] 373 then 374 build_sql 375 execute_command ${SQLSELECT} "" 376 ARG=${SAVEARG} 377 378 # If ${LOGFILE} is empty then "no rows selected" would have been returned 379 380 if [ -s ${LOGFILE} ] 381 then 382 PID=`/usr/bin/tail -1 ${LOGFILE} | /usr/bin/awk '{print $1}'` 383 384 if [ -x /sbin/zonename ] 385 then 386 /usr/bin/ps -o zone -p ${PID} | /usr/xpg4/bin/grep -q " ${ZONENAME}$" 387 else 388 /usr/bin/ps -p ${PID} > /dev/null 2>&1 389 fi 390 391 rc=$? 392 393 # Should only hit rc=1, i.e. On failover ods.ods_process is wrong 394 # If we hit rc=0 then just let it run and let oidmon fix it 395 396 case ${rc} in 397 0) continue;; 398 *) # ods.ods_process has lost it's pid or bad sql 399 execute_command ${SQLTRUNCATE} "" 400 ARG=${SAVEARG} 401 ;; 402 esac 403 fi 404 fi 405 406 # On Start, if the oidldap server is already running, oidmon will report 407 # *** Instance Number already in use. *** 408 # *** Please try a different Instance number. *** 409 # which is fine as we'll let oidmon sort it out. 410 411 execute_command "${OIAS_ORAHOME}/bin/oidctl server=oidldapd configset=0 instance=1" ${ARG} 412 413 # The oidldapd server gets run under the oidmon ptree, so here we create a pid under 414 # the pmftag (to satisfy pmf) and then turn off monitoring that pmftag 415 416 if [ "${ARG}" = "start" ] 417 then 418 /usr/bin/sleep 120 & 419 /usr/cluster/bin/pmfadm -s ${RESOURCEGROUP},${RESOURCE},0.svc 420 fi 421 422 debug_message "Function: execute_oidldapd - End" 423 } 424 425 execute_em() 426 { 427 debug_message "Function: execute_em - Begin" 428 ${SET_DEBUG} 429 430 ARG=${1} 431 432 # If the mid tier is also installed onto infrastructure failover nodes 433 # then /var/opt/oracle will contain mid tier entries. So, before the 434 # mid tier is installed the infrastructure entries in /var/opt/oracle 435 # must be saved, i.e cp -rp /var/opt/oracle /var/opt/oracle_infra 436 # before installing a mid tier instance. /var/opt/oracle_infra is then 437 # referenced when the resource is registered as ${OIAS_INFRA} 438 # 439 # This needs to be done on each infrastructure failover node where the 440 # mid tier will be installed. 441 # 442 # oidctl runs checkActiveEmdRoot() against EMDROOT using /var/opt/oracle 443 # entries and as such the infrastructure entry emtab needs to be restored 444 # prior to issuing oidctl. 445 446 check_ias_version 447 448 # 10gAS v9.0.4 does not create or use an emtab file 449 450 if [ "${rc_check_ias_version}" -eq 1 ] 451 then 452 # Save the current emtab 453 454 /usr/bin/cp /var/opt/oracle/emtab /var/opt/oracle/emtab_${RESOURCE} 455 456 # Copy the infrastructure emtab and allow for 457 # ${OIAS_INFRA}/emtab to be identical to /var/opt/oracle/emtab 458 # i.e. if ${OIAS_INFRA} is set to /var/opt/oracle 459 460 /usr/bin/cp ${OIAS_INFRA}/emtab /var/opt/oracle/emtab 2> /dev/null 461 fi 462 463 if [ "${ARG}" = "stop" ] 464 then 465 if [ "${rc_check_ias_version}" -eq 0 ] 466 then 467 execute_command "${OIAS_ORAHOME}/bin/emctl stop iasconsole" "&" 468 else 469 execute_command "/usr/bin/echo ${OIAS_ADMIN} | ${OIAS_ORAHOME}/bin/emctl stop" "&" 470 fi 471 472 sleep 10 473 474 # Cleanup the emctl stop if it's still running 475 if [ -x /sbin/zonename ] 476 then 477 PIDS=`/usr/bin/pgrep -fz ${ZONENAME} "emctl stop"` 478 else 479 PIDS=`/usr/bin/pgrep -f "emctl stop"` 480 fi 481 482 if [ "${PIDS}" ] 483 then 484 for i in ${PIDS} 485 do 486 /usr/bin/kill -9 ${i} 487 done 488 fi 489 490 # Cleanup EM if it's still running 491 492 EMDROOT_PIDS=`/usr/ucb/ps auxww | /usr/bin/grep EMDROOT | /usr/bin/grep ${OIAS_ORAHOME} | \ 493 /usr/bin/grep -v grep | /usr/bin/awk '{print $2}'` 494 495 if [ "${EMDROOT_PIDS}" ] 496 then 497 if [ -x /sbin/zonename ] 498 then 499 for i in ${EMDROOT_PIDS} 500 do 501 if /usr/bin/ps -o zone -p ${i} | /usr/xpg4/bin/grep -q " ${ZONENAME}$" 502 then 503 /usr/bin/kill -9 ${i} 504 fi 505 done 506 else 507 /usr/bin/kill -9 ${EMDROOT_PIDS} 508 fi 509 fi 510 511 else 512 if [ "${rc_check_ias_version}" -eq 0 ] 513 then 514 execute_command "${OIAS_ORAHOME}/bin/emctl ${ARG}" "iasconsole" 515 else 516 execute_command "${OIAS_ORAHOME}/bin/emctl" ${ARG} 517 fi 518 fi 519 520 if [ "${rc_check_ias_version}" -eq 1 ] 521 then 522 # Reinstate the previously saved emtab 523 /usr/bin/cp /var/opt/oracle/emtab_${RESOURCE} /var/opt/oracle/emtab 524 fi 525 526 debug_message "Function: execute_em - End" 527 } 528 529 execute_opmn() 530 { 531 debug_message "Function: execute_opmn - Begin" 532 ${SET_DEBUG} 533 534 ARG=${1} 535 536 if [ "${ARG}" = "start" ] 537 then 538 OPMN_COMPONENTS=`/usr/bin/echo ${OIAS_OPMN} | /usr/bin/tr "/" " "` 539 540 for i in ${OPMN_COMPONENTS} 541 do 542 if [ "${i}" = "ALL" ] || [ "${i}" = "All" ] || [ "${i}" = "all" ] 543 then 544 execute_command "${OIAS_ORAHOME}/opmn/bin/opmnctl" "startall" 545 else 546 check_ias_version 547 548 if [ "${rc_check_ias_version}" -eq 0 ] 549 then 550 # Start opmn daemon without starting opmn managed processes 551 if [ -x /sbin/zonename ] 552 then 553 /usr/bin/pgrep -fz ${ZONENAME} -u ${OIAS_USER} opmn >/dev/null 554 else 555 /usr/bin/pgrep -f -u ${OIAS_USER} opmn >/dev/null 556 fi 557 558 rc=$? 559 560 if [ "${rc}" -eq 1 ] 561 then 562 execute_command "${OIAS_ORAHOME}/opmn/bin/opmnctl" "start" 563 fi 564 565 # Start the ias-component OID as it is a dependent process for other ias-components 566 567 execute_command "${OIAS_ORAHOME}/opmn/bin/opmnctl status | /usr/bin/grep OID | /usr/bin/grep Alive" "" 568 569 if [ "${rc_execute_command}" -eq 1 ] 570 then 571 execute_command "${OIAS_ORAHOME}/opmn/bin/opmnctl startproc ias-component=OID" "" 572 fi 573 574 # Start the ias-componets as listed 575 576 execute_command "${OIAS_ORAHOME}/opmn/bin/opmnctl startproc ias-component=${i}" "" 577 else 578 if [ "${i}" = "ohs" ] 579 then 580 execute_command "${OIAS_ORAHOME}/dcm/bin/dcmctl start -ct ohs" "" 581 else 582 # If we get a typo component, then it will just get ignored 583 execute_command "${OIAS_ORAHOME}/dcm/bin/dcmctl start -co ${i}" "" 584 fi 585 fi 586 fi 587 done 588 else 589 execute_command "${OIAS_ORAHOME}/opmn/bin/opmnctl" ${ARG} 590 fi 591 592 debug_message "Function: execute_opmn - End" 593 } 594 595 check_oidldapd() 596 { 597 debug_message "Function: check_oidldapd - Begin" 598 ${SET_DEBUG} 599 600 rc=0 601 602 PORT=`/usr/bin/grep "Oracle Internet Directory(non-SSL)" ${OIAS_ORAHOME}/install/portlist.ini | /usr/bin/awk -F= '{print $2}'` 603 604 execute_command "${OIAS_ORAHOME}/bin/ldapsearch -v -p ${PORT} -b '' -s base '(objectclass=*)'" "" 605 606 # If oidldap didn't respond then report back 50 to allow oidmon to restart the oidldapd server 607 608 if [ "${rc_execute_command}" -ne 0 ] 609 then 610 rc=50 611 fi 612 613 debug_message "Function: check_oidldapd - End" 614 return ${rc} 615 } 616 617 check_em() 618 { 619 debug_message "Function: check_em - Begin" 620 ${SET_DEBUG} 621 622 rc_check_em=0 623 624 if [ -x /sbin/zonename ] 625 then 626 /usr/bin/pgrep -z ${ZONENAME} -f "start-em .*-R ${RESOURCE} " >/dev/null 2>&1 627 else 628 /usr/bin/pgrep -u root -f "start-em .*-R ${RESOURCE} " >/dev/null 2>&1 629 fi 630 631 rc=$? 632 633 if [ "${rc}" -eq 0 ] 634 then 635 debug_message "Function: check_em - EM is starting, check delayed" 636 rc_check_em=100 637 else 638 check_ias_version 639 640 if [ "${rc_check_ias_version}" -eq 1 ] 641 then 642 # Copy the infrastructure emtab and allow for 643 # ${OIAS_INFRA}/emtab to be identical to /var/opt/oracle/emtab 644 # i.e. if ${OIAS_INFRA} is set to /var/opt/oracle 645 646 /usr/bin/cp ${OIAS_INFRA}/emtab /var/opt/oracle/emtab 2> /dev/null 647 fi 648 649 EMDROOT_PIDS=`/usr/ucb/ps auxww | /usr/bin/grep EMDROOT | /usr/bin/grep ${OIAS_ORAHOME} | \ 650 /usr/bin/grep -v grep | /usr/bin/awk '{print $2}'` 651 652 if [ -x /sbin/zonename ] 653 then 654 for i in ${EMDROOT_PIDS} 655 do 656 if /usr/bin/ps -o zone -p ${i} | /usr/xpg4/bin/grep -q " ${ZONENAME}$" 657 then 658 rc_check_em=0 659 fi 660 done 661 else 662 if /usr/bin/ps -p ${EMDROOT_PIDS} > /dev/null 2>&1 663 then 664 rc_check_em=0 665 fi 666 fi 667 668 if [ "${rc_check_em}" -eq 0 ] 669 then 670 if [ "${rc_check_ias_version}" -eq 0 ] 671 then 672 execute_command emctl "status iasconsole" 673 674 if ! /usr/bin/grep "10g Application Server Control is running." ${LOGFILE} > /dev/null 675 then 676 rc_check_em=100 677 else 678 rc_check_em=0 679 fi 680 else 681 execute_command emctl status 682 683 if ! /usr/bin/grep "EMD is up and running" ${LOGFILE} > /dev/null 684 then 685 rc_check_em=100 686 else 687 rc_check_em=0 688 fi 689 fi 690 else 691 rc_check_em=100 692 fi 693 694 if [ "${rc_check_ias_version}" -eq 1 ] 695 then 696 # /var/opt/oracle/emtab_${RESOURCE} should already exist. 697 # i.e. It was created when the EM resource was started (see execute_em) 698 699 # Reinstate the previously saved emtab 700 701 /usr/bin/cp /var/opt/oracle/emtab_${RESOURCE} /var/opt/oracle/emtab 702 fi 703 fi 704 705 debug_message "Function: check_em - End" 706 return ${rc_check_em} 707 } 708 709 check_opmn() 710 { 711 debug_message "Function: check_opmn - Begin" 712 ${SET_DEBUG} 713 714 rc_check_opmn=0 715 716 if [ -x /sbin/zonename ] 717 then 718 /usr/bin/pgrep -z ${ZONENAME} -f "start-opmn .*-R ${RESOURCE} " >/dev/null 2>&1 719 else 720 /usr/bin/pgrep -u root -f "start-opmn .*-R ${RESOURCE} " >/dev/null 2>&1 721 fi 722 723 rc=$? 724 725 if [ "${rc}" -eq 0 ] 726 then 727 debug_message "Function: check_opmn - OPMN is starting, check delayed" 728 rc_check_opmn=100 729 else 730 if [ -x /sbin/zonename ] 731 then 732 /usr/bin/pgrep -fz ${ZONENAME} -u ${OIAS_USER} opmn >/dev/null 733 else 734 /usr/bin/pgrep -f -u ${OIAS_USER} opmn >/dev/null 735 fi 736 737 rc=$? 738 739 if [ "${rc}" -eq 1 ] 740 then 741 rc_check_opmn=100 742 else 743 check_ias_version 744 745 if [ "${rc_check_ias_version}" -eq 0 ] 746 then 747 execute_command "${OIAS_ORAHOME}/opmn/bin/opmnctl" "status" 748 749 if [ "${rc_execute_command}" -ne 0 ] 750 then 751 rc_check_opmn=100 752 fi 753 else 754 execute_command "${OIAS_ORAHOME}/dcm/bin/dcmctl" "getstate -v" 755 756 if [ "${rc_execute_command}" -eq 0 ] 757 then 758 # Issue a start request for each OPMN component that we expect to be Up, yet is Down 759 # If by chance the component was Down and now is Partially up then issuing the start will be ignored 760 761 if [ "$OIAS_OPMN" = "ALL" ] || [ "$OIAS_OPMN" = "All" ] || [ "$OIAS_OPMN" = "all" ] 762 then 763 OPMN_COMPONENTS="ohs OC4J_DAS OC4J_Demos home" 764 else 765 OPMN_COMPONENTS=`echo $OIAS_OPMN | tr "/" " "` 766 fi 767 768 OPMN_COMPONENTS_UP=`/usr/bin/grep Up ${LOGFILE} | /usr/bin/grep -v Component | /usr/bin/awk '{if (NF == 6) print $4; else if (NF == 5 ) print $2}'` 769 770 for i in ${OPMN_COMPONENTS} 771 do 772 if ! /usr/bin/echo ${OPMN_COMPONENTS_UP} | /usr/bin/grep ${i} >/dev/null 773 then 774 if [ "${i}" = "ohs" ] 775 then 776 execute_command "${OIAS_ORAHOME}/dcm/bin/dcmctl start -ct ohs" "" 777 else 778 execute_command "${OIAS_ORAHOME}/dcm/bin/dcmctl start -co ${i}" "" 779 fi 780 fi 781 done 782 else 783 rc_check_opmn=100 784 fi 785 fi 786 fi 787 fi 788 789 debug_message "Function: check_opmn - End" 790 return ${rc_check_opmn} 791 } 792 793 check_oidmon() 794 { 795 debug_message "Function: check_oidmon - Begin" 796 ${SET_DEBUG} 797 798 rc_check_oidmon=0 799 800 if [ -x /sbin/zonename ] 801 then 802 /usr/bin/pgrep -fz ${ZONENAME} -u ${OIAS_USER} oidmon >/dev/null 803 else 804 /usr/bin/pgrep -f -u ${OIAS_USER} oidmon >/dev/null 805 fi 806 807 rc=$? 808 809 if [ "${rc}" -eq 1 ] 810 then 811 rc_check_oidmon=100 812 fi 813 814 debug_message "Function: check_oidmon - End" 815 return ${rc_check_oidmon} 816 } 817