#! /bin/sh
# /etc/init.d/lbcd -- Init script for lbcd load information daemon.
#
# Written by Russ Allbery <rra@stanford.edu>
# Based on the dh-make template written by:
#
#     Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#     Modified for Debian 
#     by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
### BEGIN INIT INFO
# Provides:          lbcd
# Required-Start:    $syslog $remote_fs
# Required-Stop:     $syslog $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: lb client daemon
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/lbcd
NAME=lbcd
DESC=lbcd

set -e

test -x $DAEMON || exit 0

# Include lbcd defaults if available.
if [ -f /etc/default/lbcd ] ; then
    . /etc/default/lbcd
fi

case "$1" in
start)
    # Don't start lbcd if NO_START is set.
    if [ "$NO_START" = 1 ] ; then
        echo "Not starting $DESC (see /etc/default/$NAME)"
        exit 0
    fi
    echo -n "Starting $DESC: "
    start-stop-daemon -c lbcd -g lbcd --start --quiet --pidfile /var/run/$NAME.pid \
        --exec $DAEMON -- $DAEMON_OPTS
    echo "$NAME."
    ;;
stop)
    echo -n "Stopping $DESC: "
    start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
        --oknodo --exec $DAEMON
    echo "$NAME."
    ;;
reload)
    ;;
restart|force-reload)
    echo -n "Restarting $DESC: "
    start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
        --oknodo --exec $DAEMON
    sleep 1
    start-stop-daemon -c lbcd -g lbcd --start --quiet --pidfile /var/run/$NAME.pid \
        --exec $DAEMON -- $DAEMON_OPTS
    echo "$NAME."
    ;;
*)
    N=/etc/init.d/$NAME
    echo "Usage: $N {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
esac

exit 0
