#! /bin/sh

#### BEGIN INIT INFO
# Provides:          LCDd
# Required-Start:    $syslog $local_fs $network $remote_fs
# Required-Stop:     $syslog $local_fs $network $remote_fs
# Should-Start:      udev
# Default-Start:     2 3 4 5
# Default-Stop:      S 0 1 6
# Short-Description: LCDproc Server Daemon
# Description:       LSB init script for LCDd, the display
#                    server daemon in the LCDproc suite
### END INIT INFO


# local variables
prefix=/usr
exec_prefix=/usr
bindir=/usr/bin
sbindir=/usr/sbin
etc=/etc/sysconfig/lcdproc

PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=LCDd
DAEMON=${sbindir}/$NAME
DESC="LCDproc display server daemon"
DEFAULTS=/etc/sysconfig/lcdproc/${NAME}
START=yes
RETVAL=0


# Source defaults file; edit that file to configure this script.
if [ -e "${DEFAULTS}" ]; then
  . "${DEFAULTS}"
fi

# If we're not to start the daemon, simply exit
if [ "${START}" != "yes" ]; then
    exit 0
fi

# installation check
test -x $DAEMON || exit 5

# load LSB 3.x init functions
if [ -e /lib/lsb/init-functions ]; then
  . /lib/lsb/init-functions
fi

# Source function library.
if [ -e /etc/rc.d/init.d/functions ]; then
  . /etc/rc.d/init.d/functions
fi


case "$1" in
  start)
	echo -n $"Starting $DESC $NAME :"
	start_daemon $DAEMON $OPTIONS
	RETVAL=$?
        echo
	;;
  stop)
	echo -n $"Stopping $DESC $NAME :"
	killproc $DAEMON
	RETVAL=$?
        echo
	;;
  restart|reload|force-reload)
	$0 stop
	sleep 1
        RETVAL=0
	$0 start
	;;
  *)
	echo $"Usage: $0 {start|stop|restart|reload|force-reload}" >&2
	exit 2
	;;
esac

exit $RETVAL
