| #!/bin/bash |
| # |
| #/bin/sh |
| # @@@ START COPYRIGHT @@@ |
| # |
| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| # |
| # @@@ END COPYRIGHT @@@ |
| # |
| |
| if [ -f $TRAF_HOME/sql/scripts/sqshell.env ]; then |
| . $TRAF_HOME/sql/scripts/sqshell.env |
| fi |
| |
| if [[ -z ${TRAF_AGENT} ]]; then |
| echo "***" |
| echo "***" `date` " - Starting Monitor processes" |
| echo "***" |
| |
| sqshell <<eof |
| |
| ! Start the monitor processes across the cluster |
| startup |
| |
| set SQ_MBTYPE=$SQ_MBTYPE |
| set MY_NODES=$MY_NODES |
| set JAVA_HOME=$JAVA_HOME |
| set MY_CLUSTER_ID=$MY_CLUSTER_ID |
| set TRAF_FOUNDATION_READY=0 |
| |
| exit |
| eof |
| |
| else |
| echo `date`" - Waiting for the Trafodion monitor process..." |
| |
| # 5 seconds, iterations 240 = 20 minutes |
| let loop_count=0 |
| let loop_max=240 |
| let monitor_ready=0 |
| while [[ $loop_count -lt $loop_max ]]; |
| do |
| if sqcheckmon -f |
| then |
| let ++monitor_ready |
| break |
| else |
| echo -n "." |
| sleep 5 |
| sleep $wtime |
| let ++loop_count |
| fi |
| done |
| |
| if [[ $monitor_ready -lt 1 ]]; then |
| echo "Aborting startup!" |
| cat $TRAF_HOME/logs/sqcheckmon.log |
| exit 1 |
| else |
| |
| # Set initial registry values |
| sqshell -a <<eof |
| |
| set SQ_MBTYPE=$SQ_MBTYPE |
| set MY_NODES=$MY_NODES |
| set JAVA_HOME=$JAVA_HOME |
| set MY_CLUSTER_ID=$MY_CLUSTER_ID |
| set TRAF_FOUNDATION_READY=0 |
| |
| exit |
| eof |
| |
| echo `date`" - Delaying 15 seconds before continuing with Startup" |
| sleep 15 |
| echo `date`" - Continuing with Startup ..." |
| echo |
| fi |
| |
| # Set the number of nodes configured |
| let node_count=`trafconf -nid-count` |
| #echo "*** node_count = ${node_count}" |
| #echo "*** TRAF_SCALING_FACTOR = $TRAF_SCALING_FACTOR" |
| |
| # allow time for other nodes to integrate, scaled to cluster size |
| # scaling factor may be non-integer, so use awk to evaluate |
| start_delay=$( echo "${node_count} $TRAF_SCALING_FACTOR" | awk '{print $1 * $2}') |
| echo "***" |
| echo "***" %`date`" - Waiting ${start_delay} seconds for Monitor processes to integrate" |
| echo "***" |
| sleep $start_delay |
| fi |
| |
| sqshell -c node info |
| |
| # If the 'shell.env' file does not exist, we are in a real cluster |
| if [ -e $TRAF_HOME/sql/scripts/sqshell.env ]; then |
| sqshell -c set CLUSTERNAME=$CLUSTERNAME |
| fi |
| |
| # Starting TSID |
| |
| idtmstart |
| sqshell -c delay 1 |
| |
| echo "***" |
| echo "***" `date` " - Starting Distributed Transaction Manager (DTM)" |
| echo "***" |
| |
| tmstart |
| tm_ret=$? |
| if [ $tm_ret != 0 ]; then |
| echo "DTM start failed ..." |
| exit $tm_ret |
| fi |
| |
| echo "SQ_START_RMS: " $SQ_START_RMS |
| if [[ $SQ_START_RMS == "1" ]]; then |
| echo "Starting RMS" |
| rmsstart |
| rms_start_status=$? |
| if [[ $rms_start_status != 0 ]]; then |
| echo "RMS start failed ..." |
| exit $rms_start_status |
| fi |
| echo "Started RMS" |
| fi |
| |
| |
| echo "***" |
| echo "***" `date` " - Trafodion Foundation Services are ready!" |
| echo "***" |
| sqshell -a <<eof |
| |
| set TRAF_FOUNDATION_READY=1 |
| |
| exit |
| eof |
| |
| exit 0 |