#!/bin/ksh
###############################################################################
#
# Sun Cluster Sun MTP Data Service version 1.0
#
# Sun MTP Start script for scmtp.
#
###############################################################################
EMP_SETUP=none
EMP_SRV_ID=none
EMP_DEBUG=OFF

typeset opt

while getopts 'S:I:D:' opt
do
  case "$opt" in
    S)
    # Setup path name
    EMP_SETUP=$OPTARG
    ;;
    I)
    # Data service identifier
    EMP_SRV_ID="$OPTARG"
    ;;
    D)
    # Debug option
    EMP_DEBUG=$OPTARG
    ;;
    *)
    kixlog "mtp_start: warning option $OPTARG unknown"
    ;;
  esac
done

if [ "$EMP_SETUP" = "none" ]
then
    kixlog "mtp_start: Error. Setup file has not been specified"
    exit 101
fi

. $EMP_SETUP

if [ "$EMP_DEBUG" = "ON" ]
then
  kixlog "mtp_start: $0 started with \"$*\" parameters"
fi

if [ "$EMP_SRV_ID" = "none" ]
then
    kixlog "mtp_start: Error. Data service identifier has not been specified"
    exit 102
fi

kixverify -r ALL
kixverify_ret_status=$?

kixstart $HA_MTP_START_OPTS
kixstart_ret_status=$?

sleep 5

kixlog "MTP started as data service $EMP_SRV_ID `hostname`, database status $kixverify_ret_status, startup status $kixstart_ret_status"
exit $kixstart_ret_status
