#!/bin/sh
#
# start systemstatemonitor

RUNNINGAPPSDIR=/ross/app/bin
RUNNINGAPPSDIRCONFIGPATH=/ross/etc/runningAppsPath

if [ -f "$RUNNINGAPPSDIRCONFIGPATH" ]; then
        RADPATH=$(cat $RUNNINGAPPSDIRCONFIGPATH)
        if [ -d "$RADPATH" ]; then
                RUNNINGAPPSDIR=$RADPATH
        fi
fi

start() {
        echo -n "Starting systemstatemonitor service: "
        "$RUNNINGAPPSDIR"/systemstatemonitor -d
        echo "OK"
}

stop() {
        echo -n "Stopping systemstatemonitor service: "
        killall systemstatemonitor
        echo "Done."
}

restart() {
        stop
        start
}

case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart|reload)
                restart
                ;;
        *)
                echo "Usage: $0 {start|stop|restart}"
                exit 1
                ;;
esac

exit $?

