#!/bin/sh
# Copyright (c) 2003 Autodesk Canada Inc. / Autodesk, Inc. All Rights Reserved.
#
# These coded instructions, statements, and computer programs contain
# unpublished proprietary information written by Autodesk and
# are protected by Federal copyright law. They may not be disclosed
# to third parties or copied or duplicated in any form, in whole or
# in part, without the prior written consent of Autodesk.
#
#set -x
# The following comments are required by Redhat chkconfig
# chkconfig: 345 99 06
# description: discreet backburner

IS_ON=/sbin/chkconfig

case "$1" in
'start')
   # Test and start the Manager
   if  $IS_ON backburner_manager; then
      # start up the manager if installed
      if [ -x /etc/init.d/backburner_manager ]; then
         /etc/init.d/backburner_manager start
      fi
   fi

   # Test and start the Server
   if $IS_ON backburner_server; then
      # start up the server if installed
      if [ -x /etc/init.d/backburner_server ]; then
         /etc/init.d/backburner_server start
      fi
   fi

   ;;

'stop')

   # stop the server
   if [ -x /etc/init.d/backburner_server ]; then
      /etc/init.d/backburner_server stop
   fi

   # stop the manager
   if [ -x /etc/init.d/backburner_manager ]; then
      /etc/init.d/backburner_manager stop
   fi

   ;;

'restart')
   $0 stop
   $0 start

   ;;

*)
   echo "usage: $0 {start|stop|restart}"
   ;;
esac
