#!/bin/sh
#
# Script to start the POP3Lite POP3 daemon.
# by Gergely Nagy <8@free.bsd.hu>

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/pop3lite
NAME=pop3lite
DEBIAN_CONFIG=/etc/pop3lite-start.conf

if test -f $DEBIAN_CONFIG; then
	. $DEBIAN_CONFIG
else
	exit 0
fi

test -f $DAEMON || exit 0

test "x$from_inetd" != "xno" && exit 0

case "$1" in
  	start)
		echo -n "Starting pop3 daemon: "
		if start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
				     --exec $DAEMON
		then
    			echo $NAME.
		else
			echo .
		fi
    		;;
  	stop)
		echo -n "Stopping pop3 daemon: "
		if start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
				     --exec $DAEMON
		then
	    		echo $NAME.
		else
	    		echo $NAME not running.
		fi
    		;;
  	restart)
    		$0 force-reload
    		;;
  	force-reload)
    		echo -n "Restarting $NAME."
    		/etc/init.d/$NAME stop > /dev/null 2>&1
    		echo -n "."
    		sleep 2
    		echo -n "."
		if /etc/init.d/$NAME start > /dev/null 2>&1
    		then
			echo " done."
    		else
			echo
    		fi
    		;;
  	*)
    		echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}"
    		exit 1
    		;;
esac

exit 0


syntax highlighted by Code2HTML, v. 0.9.1