#!/bin/bash
#
# Startup script for the X Virtual Frame Buffer to be used with MatrixOne apps
# Requested by Ric Schug 02/07/2007
# Rick Myers 02/08/2007
#
# chkconfig: 345 99 99
# description: The X Virtual Frame Buffer is needed for MatrixOne apps
#
# processname: Xvfb

# Source function library.
. /etc/rc.d/init.d/functions

Xvfb="/usr/bin/Xvfb"
SERVERNUM="0"
RESOLUTION="1260x1024x24"
SCREEN="0"
FBDIR="/usr/tmp"

prog=Xvfb
RETVAL=0

start() {
        echo -n $"Starting $prog: "
        $Xvfb :$SERVERNUM -screen $SCREEN $RESOLUTION -fbdir $FBDIR &
        RETVAL=$?
        echo
        return $RETVAL
}
stop() {
	echo -n $"Stopping $prog: "
	killproc $Xvfb
	RETVAL=$?
	echo
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
        status $Xvfb
	RETVAL=$?
	;;
  *)
	echo $"Usage: $prog {start|stop|status}"
	exit 1
esac

exit $RETVAL
