381
382 rc=$?
383
384 if [ "${rc}" -eq 0 ]
385 then
386 # SCMSGS
387 # @explanation
388 # The specified Informix Server was started successfully.
389 # @user_action
390 # None required. Informational message.
391 scds_syslog -p daemon.info -t $(syslog_tag) -m \
392 "start_ids - Informix Server (%s) started rc(%s)" \
393 "${INFORMIXSERVER}" "${rc}"
394
395 # At present there is no equivalent "wait_for_online" within SMF
396 # therefore we'll perform our own.
397
398 if [ "${CALLER}" = "SMF" ]
399 then
400 smf_wait_for_online
401 rc=?
402 fi
403 else
404 # SCMSGS
405 # @explanation
406 # The specified Informix Server failed to start.
407 # @user_action
408 # Check the syslog for further messages. If possible the
409 # Solaris Cluster will attempt to restart the Informix
410 # Server.
411 scds_syslog -p daemon.error -t $(syslog_tag) -m \
412 "start_ids - Informix Server (%s) failed to start rc(%s)" \
413 "${INFORMIXSERVER}" "${rc}"
414
415 log_message error "start_ids rc(${rc})"
416 fi
417
418 debug_message "Function: start_ids - End"
419 return ${rc}
420 }
421
642 # of ${LOGFILE} is not of interest so we will clear that file.
643
644 cat /dev/null > ${LOGFILE}
645
646 get_state
647
648 if ! echo ${onstat_header} | /usr/xpg4/bin/grep -q "shared memory not initialized"
649 then
650 /usr/cluster/bin/pmfadm -s ${RESOURCEGROUP},${RESOURCE},0.svc KILL 2> /dev/null
651 fi
652
653 debug_message "Function: stop_ids - End"
654 return 0
655 }
656
657 smf_wait_for_online()
658 {
659 debug_message "Function: smf_wait_for_online - Begin"
660 ${SET_DEBUG}
661
662 MAX_START_TIMEOUT=`/usr/bin/expr ${START_TIMEOUT} \* 95 \/ 100`
663 SECONDS=0
664
665 while [ "${SECONDS}" -lt "${MAX_START_TIMEOUT}" ]
666 do
667 get_state
668 check_ids
669 rc=$?
670
671 # Check_ids will return 0 if
672 # - The Informix Server is running
673 # - No blocked on "MEDIA FAILURE" or "HANG_SYSTEM" exists
674
675 if [ "${rc}" -eq 0 ]
676 then
677 SECONDS=${MAX_START_TIMEOUT}
678 else
679 sleep 5
680 fi
681 done
682
683 debug_message "Function: smf_wait_for_online - End"
684 return ${rc}
685 }
686
687 cleanup_ipc()
688 {
689 debug_message "Function: cleanup_ipc - Begin"
690 ${SET_DEBUG}
691
692 # Cleanup any IPC shared memory segments however only if
693 #
694 # - The shared memory segment(s) are owned by
695 # OWNER=root and GROUP=informix
696 # - The shared memory has no attached processes
697 # - The CPID and LPID processes are not running
698
699 flag=
706 fi
707
708 /usr/bin/ipcs -mcopbZ | /usr/bin/grep " ${ZONENAME}$" | /usr/bin/awk ' \
709 {if (NF == 13 && $5 == "root" && $6 == "informix" && $9 == 0 ) print $2,$11,$12; else \
710 if (NF == 12 && $4 == "root" && $5 == "informix" && $8 == 0 ) print $1,$10,$11 }' | \
711 while read SHMID CPID LPID
712 do
713 if /usr/bin/ps -p ${LPID} -o zone | /usr/bin/grep " ${ZONENAME}$" > /dev/null
714 then
715 debug_message "Informix SHMID: ${SHMID} - LPID ${LPID} is running"
716 else
717 if /usr/bin/ps -p ${CPID} -o zone | /usr/bin/grep " ${ZONENAME}$" > /dev/null
718 then
719 debug_message "Informix SHMID: ${SHMID} - CPID ${CPID} is running"
720 else
721 SHMID=`/usr/bin/echo ${SHMID} | /usr/xpg4/bin/tr 'm' ' '`
722
723 # As the initial ipcs -mcopbZ is only a snapshot in time, Informix
724 # may have already cleaned up. Therefore the following attempt to remove a
725 # shared memory segment may fail with "not found". To prevent misleading
726 # console messages stdout/stderr is redirected to ${LOGFILE}.
727
728 /usr/bin/ipcrm -z ${ZONENAME} -m ${SHMID} > ${LOGFILE}
729
730 debug_message "Informix SHMID: ${SHMID} - removed"
731
732 flag=deleted
733 fi
734 fi
735 done
736
737 if [ -n "${flag}" ]
738 then
739 # SCMSGS
740 # @explanation
741 # All the Informix shared memory segments that were not being
742 # used have been removed.
743 # @user_action
744 # None required. Informational message.
745 scds_syslog -p daemon.notice -t $(syslog_tag) -m \
746 "All Informix non-attached IPC shared memory segments removed"
747 fi
748
|
381
382 rc=$?
383
384 if [ "${rc}" -eq 0 ]
385 then
386 # SCMSGS
387 # @explanation
388 # The specified Informix Server was started successfully.
389 # @user_action
390 # None required. Informational message.
391 scds_syslog -p daemon.info -t $(syslog_tag) -m \
392 "start_ids - Informix Server (%s) started rc(%s)" \
393 "${INFORMIXSERVER}" "${rc}"
394
395 # At present there is no equivalent "wait_for_online" within SMF
396 # therefore we'll perform our own.
397
398 if [ "${CALLER}" = "SMF" ]
399 then
400 smf_wait_for_online
401 rc=$?
402 fi
403 else
404 # SCMSGS
405 # @explanation
406 # The specified Informix Server failed to start.
407 # @user_action
408 # Check the syslog for further messages. If possible the
409 # Solaris Cluster will attempt to restart the Informix
410 # Server.
411 scds_syslog -p daemon.error -t $(syslog_tag) -m \
412 "start_ids - Informix Server (%s) failed to start rc(%s)" \
413 "${INFORMIXSERVER}" "${rc}"
414
415 log_message error "start_ids rc(${rc})"
416 fi
417
418 debug_message "Function: start_ids - End"
419 return ${rc}
420 }
421
642 # of ${LOGFILE} is not of interest so we will clear that file.
643
644 cat /dev/null > ${LOGFILE}
645
646 get_state
647
648 if ! echo ${onstat_header} | /usr/xpg4/bin/grep -q "shared memory not initialized"
649 then
650 /usr/cluster/bin/pmfadm -s ${RESOURCEGROUP},${RESOURCE},0.svc KILL 2> /dev/null
651 fi
652
653 debug_message "Function: stop_ids - End"
654 return 0
655 }
656
657 smf_wait_for_online()
658 {
659 debug_message "Function: smf_wait_for_online - Begin"
660 ${SET_DEBUG}
661
662 # In order to ensure that the SMF service is really online, we need
663 # to check getstate() and check_ids(). However, we need to enforce
664 # an SMF_EXIT_ERR_CONFIG if we are just about to timeout. If we do not
665 # do this, then svc.startd will try to restart the SMF service three
666 # times. Essentially we need Sun Cluster to do that.
667
668 MAX_START_TIMEOUT=`/usr/bin/expr ${START_TIMEOUT} \* 95 \/ 100`
669 SECONDS=0
670
671 while [ "${SECONDS}" -lt "${MAX_START_TIMEOUT}" ]
672 do
673 get_state
674 check_ids
675 rc=$?
676
677 # Check_ids will return 0 if
678 # - The Informix Server is running
679 # - No blocked on "MEDIA FAILURE" or "HANG_SYSTEM" exists
680
681 if [ "${rc}" -eq 0 ]
682 then
683 SECONDS=${MAX_START_TIMEOUT}
684 else
685 rc=${SMF_EXIT_ERR_CONFIG}
686 sleep 2
687 fi
688 done
689
690 debug_message "Function: smf_wait_for_online - End"
691 return ${rc}
692 }
693
694 cleanup_ipc()
695 {
696 debug_message "Function: cleanup_ipc - Begin"
697 ${SET_DEBUG}
698
699 # Cleanup any IPC shared memory segments however only if
700 #
701 # - The shared memory segment(s) are owned by
702 # OWNER=root and GROUP=informix
703 # - The shared memory has no attached processes
704 # - The CPID and LPID processes are not running
705
706 flag=
713 fi
714
715 /usr/bin/ipcs -mcopbZ | /usr/bin/grep " ${ZONENAME}$" | /usr/bin/awk ' \
716 {if (NF == 13 && $5 == "root" && $6 == "informix" && $9 == 0 ) print $2,$11,$12; else \
717 if (NF == 12 && $4 == "root" && $5 == "informix" && $8 == 0 ) print $1,$10,$11 }' | \
718 while read SHMID CPID LPID
719 do
720 if /usr/bin/ps -p ${LPID} -o zone | /usr/bin/grep " ${ZONENAME}$" > /dev/null
721 then
722 debug_message "Informix SHMID: ${SHMID} - LPID ${LPID} is running"
723 else
724 if /usr/bin/ps -p ${CPID} -o zone | /usr/bin/grep " ${ZONENAME}$" > /dev/null
725 then
726 debug_message "Informix SHMID: ${SHMID} - CPID ${CPID} is running"
727 else
728 SHMID=`/usr/bin/echo ${SHMID} | /usr/xpg4/bin/tr 'm' ' '`
729
730 # As the initial ipcs -mcopbZ is only a snapshot in time, Informix
731 # may have already cleaned up. Therefore the following attempt to remove a
732 # shared memory segment may fail with "not found". To prevent misleading
733 # console messages stdout/stderr is redirected to /dev/null.
734
735 /usr/bin/ipcrm -z ${ZONENAME} -m ${SHMID} > /dev/null 2>&1
736
737 debug_message "Informix SHMID: ${SHMID} - removed"
738
739 flag=deleted
740 fi
741 fi
742 done
743
744 if [ -n "${flag}" ]
745 then
746 # SCMSGS
747 # @explanation
748 # All the Informix shared memory segments that were not being
749 # used have been removed.
750 # @user_action
751 # None required. Informational message.
752 scds_syslog -p daemon.notice -t $(syslog_tag) -m \
753 "All Informix non-attached IPC shared memory segments removed"
754 fi
755
|