#!/bin/bash 
#
#      -*- OpenSAF  -*-
#
# (C) Copyright 2008 The OpenSAF Foundation
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed
# under the GNU Lesser General Public License Version 2.1, February 1999.
# The complete license can be accessed from the following location:
# http://opensource.org/licenses/lgpl-license.php
# See the Copying file included with the OpenSAF distribution for full
# licensing terms.
#
# Author(s): Emerson Network Power
#

source "/etc/opensaf/script.conf"

# First step at merging controller/payload scripts
# This ugliness will be cleaned later

if [ "$NODE_TYPE" == "controller" ]; then

#XTERM="xterm -e /usr/bin/gdb"    # Set this if debugging(etc...) required
XTERM=""


echo "Executing MQND-init-script...";
echo "NCS_STDOUTS_PATH=$NCS_STDOUTS_PATH"
$XTERM "$LIBPATH/ncs_mqnd" >> "$NCS_STDOUTS_PATH/ncs_mqnd.log" 2>&1 &
exit 0

elif [ "$NODE_TYPE" == "payload" ]; then

#XTERM="xterm -e /usr/bin/gdb"    # Set this if debugging(etc...) required
XTERM=""


echo "Executing MQND-init-script...";
echo "NCS_STDOUTS_PATH=$NCS_STDOUTS_PATH"
$XTERM "$LIBPATH/ncs_mqnd" >> "$NCS_STDOUTS_PATH/ncs_mqnd.log" 2>&1 &
exit 0

else

echo "Error, unsupported NODE_TYPE: $NODE_TYPE\n"
exit -1

fi
