#!/bin/bash

STOP_SCRIPT=/opt/midas/bin/stop-marmaserver

if [ "`hostname`" == "MC-1" ]; then
    ${STOP_SCRIPT} &
else
    ssh MC-1 "${STOP_SCRIPT}" &
fi

# don't do this for DL1/2 (only XL8/DL3 have bonded network ports, PROX has a different port naming)
if [ -n "`ip addr | grep inet | grep bond0`" ]; then
    if [ "`hostname`" == "MC-2" ]; then
        ${STOP_SCRIPT}
    else
        ssh MC-2 "${STOP_SCRIPT}" 
    fi
fi
