#!/usr/local/bin/bash
#
# Start/stop cego daemon 
#

# location of the cego program
CEGO=/usr/local/bin/cego
# location of the cego configuration file
CGXML=/usr/local/cegodb/cegodb.xml
# location of the cego log file
CGLOG=/usr/local/cegodb/cego.log
# name of the tableset, which should be started up
TS=TS1

rc=0

case "$1" in
'start')
        $CEGO --mode=daemon --dbxml=$CGXML --logfile=$CGLOG --tableset=$TS &
	rc=$?
        sleep 2
        ;;
'restart')
        $CEGO --mode=daemon --dbxml=$CGXML --logfile=$CGLOG --tableset=$TS &
	rc=$?
        sleep 2
        ;;
'stop')
	PID=`cat /usr/local/cegodb/pid`
        /usr/bin/kill -s INT $PID 
        ;;
*)
        echo "Usage: $0 { start | restart | stop }"
        exit 1
        ;;
esac
exit $rc
