#!/bin/sh

PATH=${PATH}:/usr/local/bin:/usr/local/sbin

cd /usr/local/controller/spectrum/SpectrumMonitoring || exit 1;

case "$1" in
        start)
            PID=`ps x -o pid,command | grep start.pl | grep -v grep | awk '{print $1}'`
            if [ "$PID" != "" ]; then
                echo -n "spectrum stop; "
                ./stop.sh > /dev/null 2>&1
            fi
            
            ./start.pl > /dev/null 2>&1 &
	    	echo -n "spectrum start; "
                ;;
        stop)
    		./stop.sh > /dev/null 2>&1
    		echo -n "spectrum stop; "
    		exit 0
                ;;
        *)
                echo ""
                echo "Usage: `basename $0` { start | stop }"
                echo ""
                exit 64
                ;;
esac
