#!/bin/sh
. /var/config/emu.conf
echo "Reload" > /dev/dbox/fp0
sleep 1
# EMU List
e1=mpcs
e2=camd3
e3=incubusCamd
e4=mbox
e5=kbox
e6=mgcamd


if [ $emu = $e1 ]
then
kill -9 `pidof mpcs` 2>/dev/null
kill -9 `pidof mpcs` 2>/dev/null
killall mpcs 2>/dev/null
echo "MPCS STOP" > /dev/dbox/fp0
else
echo
fi

if [ $emu = $e2 ]
then
kill -9 `pidof camd3` 2>/dev/null
kill -9 `pidof camd3` 2>/dev/null
killall camd3 2>/dev/null
echo "CAMD3 STOP" > /dev/dbox/fp0
else
echo
fi


if [ $emu = $e3 ]
then
kill -9 `pidof incubusCamd` 2>/dev/null
kill -9 `pidof incubusCamd` 2>/dev/null
killall incubusCamd 2>/dev/null
echo "InCubus STOP" > /dev/dbox/fp0
else
echo
fi

if [ $emu = $e4 ]
then
kill -9 `pidof mbox` 2>/dev/null
kill -9 `pidof mbox` 2>/dev/null
killall mbox 2>/dev/null
echo "MBOX STOP" > /dev/dbox/fp0
else
echo
fi

if [ $emu = $e5 ]
then
kill -9 `pidof kbox` 2>/dev/null
kill -9 `pidof kbox` 2>/dev/null
killall kbox 2>/dev/null
echo "KBOX STOP" > /dev/dbox/fp0
else
echo
fi

if [ $emu = $e6 ]
then
kill -9 `pidof mgcamd` 2>/dev/null
kill -9 `pidof mgcamd` 2>/dev/null
killall mgcamd 2>/dev/null
echo "MGCAMD STOP" > /dev/dbox/fp0
else
echo
fi

sleep 2
echo "Load Config" > /dev/dbox/fp0
