#!/bin/bash

if [ -f /etc/init.d/meru-functions ]; then
        . /etc/init.d/meru-functions
else
        echo "/etc/init.d/meru-functions must exist to use $0"; exit 1
fi

set_params

if [ "$SECOND_INTERFACE_MODE" ]; then
	case "$SECOND_INTERFACE_MODE" in
		"redundant")
			CUR_REAL_IF=`/sbin/ifconfig | /bin/grep eth | awk -F' ' '{ print $1}'`

			if [ "$CUR_REAL_IF" = "$REAL_IF" ];then
				echo "Second interface is acting as redundant"
			elif [ "$CUR_REAL_IF" = "$SECOND_IF" ];then
				echo "Second interface is active"
            else
                echo "Both the interfaces are down"
			fi
			;;
		"active")
			echo "The second interface is in active mode, this command should be used only when the second interface has been configured as redundant"
			;;
		"none")
			echo "The second interface has not been configured, this command should be used only when the second interface has been configured in redundant mode"
			;;
	esac
else
	echo "The second interface has not been configured, this command should be used only when the second interface has been configured in redundant mode"
fi
