#!/bin/sh
# chkconfig: - 12 90
# description: Keyboard LED interface activity indicator
# processname: ifled
# config: /etc/sysconfig/ifled
# pidfile: /var/run/ifled.pid
WITHOUT_RC_COMPAT=1
# Source function library.
. /etc/init.d/functions

# Source networking configuration.
SourceIfNotEmpty /etc/sysconfig/network && is_yes "$NETWORKING" || exit

# Check ifled config
[ -f /etc/sysconfig/ifled ] || exit 0
. /etc/sysconfig/ifled

RETVAL=0
LOCKFILE=/var/lock/subsys/ifled

start()
{
	start_daemon --lockfile "$LOCKFILE" --expect-user root -- ifled $IFLED_ARGS -f
	RETVAL=$?
	return $RETVAL
}	

stop()
{
	stop_daemon --lockfile "$LOCKFILE" --expect-user root -- ifled
	RETVAL=$?
	return $RETVAL
}

restart()
{
	stop
	start
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	restart
	;;
  condstop)
	# Stop the servcie if it is already running
	if [ -e "$LOCKFILE" ]; then
	 stop
	fi
	;;
  condrestart|condreload)
	# Restart the service if it is already running
	if [ -e "$LOCKFILE" ]; then
 	 restart
	fi
	;;
  status)
	# report the status of the daemons in free-form format
	status --pidfile "$PIDFILE" --expect-user root -- ifled
	RETVAL=$?
	;;
  *)
	echo "Usage: ${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}"
	RETVAL=1
esac

exit $RETVAL
