Cdiff functions.ksh
*** /workspace/neilga/ohacds-ids/webrev/usr/src/cmd/ha-services/gds-agents/ids/functions.ksh-   Tue May 27 03:22:56 2008
--- functions.ksh       Tue May 27 03:16:22 2008

*** 19,29 **** # CDDL HEADER END # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # ! #ident "@(#)functions.ksh 1.4 08/04/29 SMI" # PKG=SUNWscids LOGFILE=/var/tmp/${RESOURCE}_logfile TASK_COMMAND="" --- 19,29 ---- # CDDL HEADER END # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # ! #ident "@(#)functions.ksh 1.5 08/05/27 SMI" # PKG=SUNWscids LOGFILE=/var/tmp/${RESOURCE}_logfile TASK_COMMAND=""
*** 50,60 **** p) PRI=${OPTARG};; esac done shift $((${OPTIND} - 1)) ! LOG_STRING=`/usr/bin/printf "$@"` ${LOGGER} -p ${PRI} -t ${TAG} ${LOG_STRING} fi } debug_message() --- 50,60 ---- p) PRI=${OPTARG};; esac done shift $((${OPTIND} - 1)) ! LOG_STRING=$(/usr/bin/printf "$@") ${LOGGER} -p ${PRI} -t ${TAG} ${LOG_STRING} fi } debug_message()
*** 72,82 **** } log_message() { debug_message "Function: log_message - Begin" ! {SET_DEBUG} if [ -s "${LOGFILE}" ] then PRIORITY=$1 HEADER=$2 --- 72,82 ---- } log_message() { debug_message "Function: log_message - Begin" ! ${SET_DEBUG} if [ -s "${LOGFILE}" ] then PRIORITY=$1 HEADER=$2
*** 152,162 **** if [ "${USERID}" = "informix" ] then debug_message "Validate - Userid is informix" else ! pgroup=`/usr/bin/getent passwd ${USERID} | /usr/bin/awk -F: '{print $4}'` if [ -n "${pgroup}" ] then if /usr/bin/getent group ${pgroup} | /usr/bin/awk -F: '{ if ($1 == "informix") print $3}' | \ /usr/bin/grep "^${pgroup}$" > /dev/null --- 152,162 ---- if [ "${USERID}" = "informix" ] then debug_message "Validate - Userid is informix" else ! pgroup=$(/usr/bin/getent passwd ${USERID} | /usr/bin/awk -F: '{print $4}') if [ -n "${pgroup}" ] then if /usr/bin/getent group ${pgroup} | /usr/bin/awk -F: '{ if ($1 == "informix") print $3}' | \ /usr/bin/grep "^${pgroup}$" > /dev/null
*** 342,353 **** debug_message "Function: start_ids - Begin" ${SET_DEBUG} /usr/bin/rm ${LOGFILE} 2> /dev/null - if [ "${CALLER}" = "GDS" ] - then get_state check_ids debug rc=$? # Check_ids will return 0 if --- 342,351 ----
*** 370,386 **** "${INFORMIXSERVER}" return 0 fi ! /usr/bin/su ${USERID} -c "${TASK_COMMAND} env INFORMIXDIR=${INFORMIXDIR} INFORMIXSERVER=${INFORMIXSERVER} INFORMIXSQLHOSTS=${INFORMIXSQLHOSTS} ONCONFIG=${ONCONFIG} ${INFORMIXDIR}/bin/oninit -y ${OUTPUT} &" > /dev/null - else - env INFORMIXDIR=${INFORMIXDIR} INFORMIXSERVER=${INFORMIXSERVER} INFORMIXSQLHOSTS=${INFORMIXSQLHOSTS} ONCONFIG=${ONCONFIG} ${INFORMIXDIR}/bin/oninit -y > ${LOGFILE} 2>&1 & - - fi - rc=$? if [ "${rc}" -eq 0 ] then # SCMSGS --- 368,379 ---- "${INFORMIXSERVER}" return 0 fi ! /usr/bin/su ${USERID} -c "${TASK_COMMAND} /usr/bin/env INFORMIXDIR=${INFORMIXDIR} INFORMIXSERVER=${INFORMIXSERVER} INFORMIXSQLHOSTS=${INFORMIXSQLHOSTS} ONCONFIG=${ONCONFIG} ${INFORMIXDIR}/bin/oninit -y ${OUTPUT} &" > /dev/null rc=$? if [ "${rc}" -eq 0 ] then # SCMSGS
*** 389,407 **** # @user_action # None required. Informational message. scds_syslog -p daemon.info -t $(syslog_tag) -m \ "start_ids - Informix Server (%s) started rc(%s)" \ "${INFORMIXSERVER}" "${rc}" - - # At present there is no equivalent "wait_for_online" within SMF - # therefore we'll perform our own. - - if [ "${CALLER}" = "SMF" ] - then - smf_wait_for_online - rc=$? - fi else # SCMSGS # @explanation # The specified Informix Server failed to start. # @user_action --- 382,391 ----
*** 422,442 **** check_start() { debug_message "Function: check_start - Begin" ${SET_DEBUG} - if [ "${CALLER}" = "GDS" ] - then if [ -x /sbin/zonename ] then /usr/bin/pgrep -z ${ZONENAME} -f "$1 .*-R ${RESOURCE} " >/dev/null 2>&1 else /usr/bin/pgrep -u root -f "$1 .*-R ${RESOURCE} " >/dev/null 2>&1 fi - else - /usr/bin/pgrep -u ${USERID} -f "$1 ${RESOURCE} " >/dev/null 2>&1 - fi rc=$? debug_message "Function: check_start - End" return ${rc} --- 406,421 ----
*** 474,497 **** # # After IDS is started. # # IBM Informix Dynamic Server Version 11.10.FC1 -- On-Line -- Up 01:47:59 -- 29696 Kbytes ! if [ "${CALLER}" = "GDS" ] ! then ! onstat_header=`/usr/bin/su ${USERID} -c "${TASK_COMMAND} env INFORMIXDIR=${INFORMIXDIR} INFORMIXSERVER=${INFORMIXSERVER} INFORMIXSQLHOSTS=${INFORMIXSQLHOSTS} ONCONFIG=${ONCONFIG} ${INFORMIXDIR}/bin/onstat - | /usr/bin/grep ."` ! else ! onstat_header=`env INFORMIXDIR=${INFORMIXDIR} INFORMIXSERVER=${INFORMIXSERVER} INFORMIXSQLHOSTS=${INFORMIXSQLHOSTS} ONCONFIG=${ONCONFIG} ${INFORMIXDIR}/bin/onstat - | /usr/bin/grep .` ! fi if echo ${onstat_header} | /usr/xpg4/bin/grep -q "Informix Dynamic Server" then ! onstat_mode=`echo ${onstat_header} | /usr/bin/sed -e 's/ -- Up.*$//' -e 's/^.*-- //'` if echo ${onstat_header} | /usr/xpg4/bin/grep -q "Blocked:" then ! onstat_blocked=`echo ${onstat_header} | /usr/bin/sed -e 's/^.*Blocked://'` else onstat_blocked="" fi fi --- 453,471 ---- # # After IDS is started. # # IBM Informix Dynamic Server Version 11.10.FC1 -- On-Line -- Up 01:47:59 -- 29696 Kbytes ! onstat_header=$(/usr/bin/su ${USERID} -c "${TASK_COMMAND} /usr/bin/env INFORMIXDIR=${INFORMIXDIR} INFORMIXSERVER=${INFORMIXSERVER} INFORMIXSQLHOSTS=${INFORMIXSQLHOSTS} ONCONFIG=${ONCONFIG} ${INFORMIXDIR}/bin/onstat - | /usr/bin/grep .") if echo ${onstat_header} | /usr/xpg4/bin/grep -q "Informix Dynamic Server" then ! onstat_mode=$(echo ${onstat_header} | /usr/bin/sed -e 's/ -- Up.*$//' -e 's/^.*-- //') if echo ${onstat_header} | /usr/xpg4/bin/grep -q "Blocked:" then ! onstat_blocked=$(echo ${onstat_header} | /usr/bin/sed -e 's/^.*Blocked://') else onstat_blocked="" fi fi
*** 581,591 **** ;; esac debug_message "check_ids - ${onstat_header}" ! if [ "${CALLER}" = "GDS" -a "${LEVEL}" != "debug" ] then # While we tolerate some blocked states we will output a status message # to Solaris Cluster if one is found. Nevertheless the resource remains online. saved_rc=${rc} --- 555,565 ---- ;; esac debug_message "check_ids - ${onstat_header}" ! if [ "${LEVEL}" != "debug" ] then # While we tolerate some blocked states we will output a status message # to Solaris Cluster if one is found. Nevertheless the resource remains online. saved_rc=${rc}
*** 613,633 **** stop_ids() { debug_message "Function: stop_ids - Begin" ${SET_DEBUG} ! MAX_STOP_TIMEOUT=`/usr/bin/expr ${STOP_TIMEOUT} \* 70 \/ 100` SECONDS=0 ! if [ "${CALLER}" = "GDS" ] ! then ! /usr/bin/su ${USERID} -c "${TASK_COMMAND} env INFORMIXDIR=${INFORMIXDIR} INFORMIXSERVER=${INFORMIXSERVER} INFORMIXSQLHOSTS=${INFORMIXSQLHOSTS} ONCONFIG=${ONCONFIG} ${INFORMIXDIR}/bin/onmode -uky ${OUTPUT} &" > /dev/null - else - env INFORMIXDIR=${INFORMIXDIR} INFORMIXSERVER=${INFORMIXSERVER} INFORMIXSQLHOSTS=${INFORMIXSQLHOSTS} ONCONFIG=${ONCONFIG} ${INFORMIXDIR}/bin/onmode -uky > ${LOGFILE} 2>&1 & - fi - while [ "${SECONDS}" -lt "${MAX_STOP_TIMEOUT}" ] do get_state if echo ${onstat_header} | /usr/xpg4/bin/grep -q "shared memory not initialized" --- 587,601 ---- stop_ids() { debug_message "Function: stop_ids - Begin" ${SET_DEBUG} ! MAX_STOP_TIMEOUT=$(/usr/bin/expr ${STOP_TIMEOUT} \* 70 \/ 100) SECONDS=0 ! /usr/bin/su ${USERID} -c "${TASK_COMMAND} /usr/bin/env INFORMIXDIR=${INFORMIXDIR} INFORMIXSERVER=${INFORMIXSERVER} INFORMIXSQLHOSTS=${INFORMIXSQLHOSTS} ONCONFIG=${ONCONFIG} ${INFORMIXDIR}/bin/onmode -uky ${OUTPUT} &" > /dev/null while [ "${SECONDS}" -lt "${MAX_STOP_TIMEOUT}" ] do get_state if echo ${onstat_header} | /usr/xpg4/bin/grep -q "shared memory not initialized"
*** 652,698 **** debug_message "Function: stop_ids - End" return 0 } - smf_wait_for_online() - { - debug_message "Function: smf_wait_for_online - Begin" - ${SET_DEBUG} - - # In order to ensure that the SMF service is really online, we need - # to check getstate() and check_ids(). However, we need to enforce - # an SMF_EXIT_ERR_CONFIG if we are just about to timeout. If we do not - # do this, then svc.startd will try to restart the SMF service three - # times. Essentially we need Sun Cluster to do that. - - MAX_START_TIMEOUT=`/usr/bin/expr ${START_TIMEOUT} \* 95 \/ 100` - SECONDS=0 - - while [ "${SECONDS}" -lt "${MAX_START_TIMEOUT}" ] - do - get_state - check_ids - rc=$? - - # Check_ids will return 0 if - # - The Informix Server is running - # - No blocked on "MEDIA FAILURE" or "HANG_SYSTEM" exists - - if [ "${rc}" -eq 0 ] - then - SECONDS=${MAX_START_TIMEOUT} - else - rc=${SMF_EXIT_ERR_CONFIG} - sleep 2 - fi - done - - debug_message "Function: smf_wait_for_online - End" - return ${rc} - } - cleanup_ipc() { debug_message "Function: cleanup_ipc - Begin" ${SET_DEBUG} --- 620,629 ----
*** 723,733 **** else if /usr/bin/ps -p ${CPID} -o zone | /usr/bin/grep " ${ZONENAME}$" > /dev/null then debug_message "Informix SHMID: ${SHMID} - CPID ${CPID} is running" else ! SHMID=`/usr/bin/echo ${SHMID} | /usr/xpg4/bin/tr 'm' ' '` # As the initial ipcs -mcopbZ is only a snapshot in time, Informix # may have already cleaned up. Therefore the following attempt to remove a # shared memory segment may fail with "not found". To prevent misleading # console messages stdout/stderr is redirected to /dev/null. --- 654,664 ---- else if /usr/bin/ps -p ${CPID} -o zone | /usr/bin/grep " ${ZONENAME}$" > /dev/null then debug_message "Informix SHMID: ${SHMID} - CPID ${CPID} is running" else ! SHMID=$(/usr/bin/echo ${SHMID} | /usr/xpg4/bin/tr 'm' ' ') # As the initial ipcs -mcopbZ is only a snapshot in time, Informix # may have already cleaned up. Therefore the following attempt to remove a # shared memory segment may fail with "not found". To prevent misleading # console messages stdout/stderr is redirected to /dev/null.