#!@SHELL@
#
# Copyright (c) 1991, by Sun Microsystems, Inc.
#
#ident  "@(#)runqueue     0.1     2000/06/06 DA"

DBDIR=@prefix@
BATCHDIR=$DBDIR/batch
LOGFILE=$BATCHDIR/run_queue.log
USER=dbase

case "$1" in
'start')
	echo "Starting run_queue..."
	su $USER -c $BATCHDIR/run_queue.pl >> $LOGFILE 2>&1 &
        ;;
'stop')
	echo "Stopping run_queue..."
	RUNQUEUEPID=`ps -ef | grep run_queue.pl | grep -v grep | awk '{print $2}'`
        if test "$RUNQUEUEPID"
        then
                /usr/bin/kill $RUNQUEUEPID
        fi
        ;;
*)
        echo "Usage: $0 { start | stop }"
        ;;
esac
exit 0

