blob: 7a74d8102c5b5f47b13b57d1dcae681d35d9403c [file] [log] [blame]
#!/bin/bash
# @@@ 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 @@@
export TRAF_CONFIG=/etc/trafodion/trafodion_config
source $TRAF_CONFIG
if [[ "$all_node_count" -eq "1" ]]; then
STARTING_NODE=$NODE_LIST
else
STARTING_NODE=$(echo $MY_NODES | awk '{print $2}')
fi
#==========================================
if [ "$START" == "N" ]; then
echo "***INFO: Trafodion will not be started, skipping sqstart." | tee -a $INSTALL_LOG
else
echo "***INFO: starting Trafodion instance" | tee -a $INSTALL_LOG
ssh $STARTING_NODE "cd $TRAF_HOME/sql/scripts; sqstart"
SQSTART_RC=$?
if [ "$SQSTART_RC" != "0" ]; then
echo "***ERROR: sqstart failed with RC=$SQSTART_RC. Check $TRAF_HOME/sqmon.log file for details." | tee -a $INSTALL_LOG
exit -1;
fi
# Do init_trafodion if specified
if [ "$INIT_TRAFODION" == "Y" ]; then
echo
echo
echo "***INFO: Trafodion is initializing...this will take a few minutes."
echo
echo
ssh $STARTING_NODE "cd $TRAF_HOME/sql/scripts; echo \"initialize Trafodion;\" | sqlci" | tee -a $TRAF_HOME/initializeErrors.txt
error1392=$(grep "1392" $TRAF_HOME/initializeErrors.txt | wc -l)
error1395=$(grep "1395" $TRAF_HOME/initializeErrors.txt | wc -l)
if [ "$error1395" -ge "1" ] || [ "$error1392" -ge "1" ]; then
ssh $STARTING_NODE "cd $TRAF_HOME/sql/scripts; echo \"get version of metadata;\" | sqlci" | tee $TRAF_HOME/initializeErrors.txt
metadataCurrent=$(grep "Metadata is current" $TRAF_HOME/initializeErrors.txt | wc -l)
if [[ "$metadataCurrent" -ne "1" ]]; then
ssh $STARTING_NODE "cd $TRAF_HOME/sql/scripts; echo \"initialize Trafodion, upgrade;\" | sqlci" | tee $TRAF_HOME/initializeErrors.txt
fi
fi
anyError=$(grep "ERROR" $TRAF_HOME/initializeErrors.txt | wc -l)
if [[ "$anyError" != "0" ]]; then
echo "***ERROR: initialize Trafodion failed. Check install log files for details." | tee -a $INSTALL_LOG
exit -1;
fi
fi
fi
#==========================================
echo "***INFO: Installation setup completed successfully." | tee -a $INSTALL_LOG