#! /bin/sh
#
#************** Copyright (c) 2002 Trimble Navigation Limited **********
# $Id: frontpanel,v 1.5 2003/07/02 18:03:14 sven Exp $
# $Source: /home/CVS/fireballTop/fireballFS/root/etc/init.d/frontpanel,v $
#------------------------------------------------------------
#

# frontpanel		controls the front panel manager task, which 
#			monitors the Sleep button and governs leds
#
# Version:      @(#)frontpanel	Sven_Dietrich@trimble.com 6/7/2002
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin

prog="front panel manager"
frontpanel=/usr/local/fireball/frontpanel_task
RETVAL=0

start() {
        start-stop-daemon -S -x $frontpanel $OPTIONS
        RETVAL=$?
        [ $RETVAL = 0 ] && touch /var/lock/subsys/frontpanel
        echo
        return $RETVAL
	}

stop() {
        echo -n $"Stopping $prog: "
        start-stop-daemon -K -x $frontpanel $OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/frontpanel /var/run/frontpanel.pid
	}

# See how we were called.
case "$1" in
  start)
          start 
	  ;; 
  stop) 
  	  stop 
	  ;; 
  restart)
        stop 
        sleep 3
	start 
	;;
  reload)
        echo -n $"Reloading $prog: "
        killproc $frontpanel -HUP
        RETVAL=$?
        echo
        ;;
  condrestart)
        if [ -f /var/run/frontpanel.pid ] ; then
             stop
             start
        fi
        ;;
   *)
        echo $"Usage: $prog {start|stop|restart|reload|condrestart}"
        exit 1
esac

exit $RETVAL

