#!/bin/sh -e

### BEGIN INIT INFO
# Provides:          LCDd
# Required-Start:    $syslog $local_fs $network $remote_fs
# Required-Stop:     $syslog $local_fs $network $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      S 0 1 6
# Short-Description: LCDproc Server Daemon
# Description:       Debian 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

NAME=LCDd
DAEMON=${sbindir}/${NAME}
DESC="LCDproc display server daemon"
OPTIONS=""

# installation check
test -x ${DAEMON} || exit 0

case "$1" in
    start)
	printf "Starting ${DESC}: "
	start-stop-daemon --start --quiet --exec ${DAEMON} -- ${OPTIONS}
	printf "${NAME}.\n"
	;;
    stop)
	printf "Stopping ${DESC}: "
	start-stop-daemon --stop  --quiet --exec ${DAEMON}
	printf "${NAME}.\n"
	;;
    restart|force-restart)
	$0 stop
	sleep 4
	$0 start
	;;
    *)
	printf "Usage: $0 {start|stop|restart|force-restart}\n" >&2
	exit 1
	;;
esac

exit 0
