#!/bin/sh
#
# poprelayd   This shell script takes care of starting and stopping
#             the pop-log-scrubber and sendmail relay db population tool.
# 
#             Will DeHaan <will@cobaltnet.com> Aug 10 1999
#
# chkconfig: 235 90 90
# description: POP-before-SMTP relay engine

[ -f /usr/local/sbin/poprelayd ] || exit 0

PID=/var/run/poprelayd.pid
DAEMON=/usr/local/sbin/poprelayd

# See how we were called.
case "$1" in
  start)
	# Start daemons.

	# No more than one daemon instance!
	if [ -e $PID ]; then
	  echo "Shutting down current poprelayd..."
	  kill `cat $PID` 2>&1 > /dev/null
	fi

	echo -n "Starting poprelayd."
	$DAEMON -d
	echo
	;;
  stop)
	# Stop daemons.
	echo -n "Shutting down poprelayd."
	kill `cat $PID`
	$DAEMON -f
	echo
	;;
  restart)
	$0 stop
	$0 start
	;;
  *)
	echo "Usage: poprelayd start|stop|restart"
	exit 1
esac

exit 0

