#!/bin/sh

DAEMON=/usr/sbin/lpd

test -x $DAEMON || exit 0

case "$1" in
  start)
	echo -n "Starting printer spooler: lpd"
	start-stop-daemon --start --quiet --exec $DAEMON
	echo "."
	;;
  stop)
	echo -n "Stopping printer spooler: lpd"
	start-stop-daemon --stop --quiet --pidfile /var/run/lpd.pid --exec $DAEMON
	kill $(pidof lpd)
	echo "."
	;;
  restart|force-reload)
	echo -n "Restarting printer spooler: lpd"
	start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/lpd.pid --exec $DAEMON
	kill $(pidof lpd)
	sleep 2
	start-stop-daemon --start --quiet --exec $DAEMON
	echo "."
	;;
  *)
        echo "Usage: /etc/init.d/lpd {start|stop|restart}"
        exit 1
esac

exit 0
