#! /bin/sh
### BEGIN INIT INFO
# Provides:          netplan
# Required-Start:    $remote_fs $network $syslog
# Required-Stop:     $remote_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Netplan calendar service.
# Description:       The server part of plan.
### END INIT INFO
# Set ENABLED=0 to disable, ENABLED=1 to enable.
ENABLED=0

DAEMON=/usr/sbin/netplan
DAEMONOPTS=-s
PATH=/bin:/usr/bin:/sbin:/usr/sbin

# Load local overrides
if [ -f /etc/default/netplan ] ; then
    . /etc/default/netplan
fi

test -f $DAEMON || exit 0

if [ "$ENABLED" = 0 ]
then
    echo "Netplan daemon not enabled in /etc/init.d/netplan."
    exit 0
fi

case "$1" in
  start)
    echo -n "Starting plan appointment daemon: netplan"
    start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMONOPTS
    echo "."
    ;;
  stop)
    echo -n "Stopping plan appointment daemon: netplan"
    start-stop-daemon --stop --quiet --exec $DAEMON -- $DAEMONOPTS
    echo "."
    ;;
  restart | force-reload)
    echo -n "Stopping plan appointment daemon: netplan"
    start-stop-daemon --stop --quiet --exec $DAEMON -- $DAEMONOPTS
    echo "."
    echo -n "Restarting plan appointment daemon: netplan"
    start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMONOPTS
    echo "."
    ;;
  *)
    echo "Usage: /etc/init.d/plan {start|stop|restart|force-reload}"
    exit 1
    ;;
esac
exit 0
