
#!/bin/sh

PID="/var/run/dataexplorer.pid"




start() {
    if [ -e "${PID}" ]; then
        echo "dataexplorer plugin already started"
    else
        echo "dataexplorer plugin starting ..."
        glib-app -n dataexplorer -c /usr/lib/dataexplorer/dataexplorer.odl
    fi
}

stop() {
    if [ -e "${PID}" ]; then
        echo "kill dataexplorer daemon"
        kill $(cat $PID)
        rm $PID
    else
        echo "dataexplorer plugin not running"
    fi
}



case $1 in
    start)
        start
        ;;
    stop)
        stop
        ;;

    restart)
        stop
        start
        ;;
    debuginfo)
        if [ -f "${PID}" ]; then
            echo "dataexplorer is running, pid=$(cat ${PID})"
        else
            echo "dataexplorer is not running"
        fi
        ;;
    *)
        echo "Usage : $0 [start|stop|restart|debuginfo]"
        ;;
esac

