#!/bin/sh
# Start/stop/restart lpd, the BSD-style printer daemon from LPRng.
#
# By default, no print spooler is run.  To select one, edit the
# SPOOLER variable in /etc/rc.d/rc.M.

# Start lpd:
lpd_start() {
  if [ -x /usr/sbin/lpd ]; then
    echo "Starting the LPRng line printer daemon:  /usr/sbin/lpd"
    /usr/sbin/lpd
  fi
}

# Stop lpd:
lpd_stop() {
  killall lpd
}

# Restart lpd:
lpd_restart() {
  lpd_stop
  sleep 1
  lpd_start
}

case "$1" in
'start')
  lpd_start
  ;;
'stop')
  lpd_stop
  ;;
'restart')
  lpd_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac
