#! /bin/sh
#

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/gnu-pop3d
# WARNING, gnu pop does not allow spaces between options
MAX_CHILDREN=5

test -f $DAEMON || exit 0
grep -q "^pop-3" /etc/inetd.conf && exit 0

case "$1" in
  start)
    start-stop-daemon --start --verbose --exec $DAEMON -- -d$MAX_CHILDREN
    ;;
  stop)
    start-stop-daemon --stop --verbose --exec $DAEMON
    ;;
  restart|force-reload)
  	start-stop-daemon --stop --verbose --exec $DAEMON
	start-stop-daemon --start --verbose --exec $DAEMON -- -d$MAX_CHILDREN
	;;
  *)
    echo "Usage: /etc/init.d/gnu-pop3d {start|stop|restart|force-reload}"
    exit 1
    ;;
esac

exit 0
