#!/bin/sh

# proxsmtpd       Bring up/down SMPT proxying
#
# chkconfig: 2345 10 90
# description: Activates/Deactivates Nate Nielson's SMTP proxy daemon
#

#
# This ProxSMTPD script was adapted for Red Hat Linux by Michael Weber.
# mpweber77-shift-2-netscape.net
#
# This is released under the same license as ProxSMTP written by Stef Walter.
#

###########################################################################
# CONFIGURATION

# Most configuration options are found in the proxsmtpd.conf file.
# For more info see:
#   man proxsmtpd.conf

prog="proxsmtpd"

# The prefix proxsmtpd was installed to
prefix=/usr/local/

# The location for pid file
piddir=/var/run

# source function library
. /etc/rc.d/init.d/functions

OPTIONS=" -f /etc/proxsmtpd.conf -p $piddir/proxsmtpd.pid "

###########################################################################


start()
{
        echo -n $"Starting $prog:"
        $prefix/sbin/$prog $OPTIONS && success || failure
        RETVAL=$?
        [ "$RETVAL" = 0 ] && touch /var/lock/subsys/$prog
        echo
}

stop()
{
        echo -n $"Stopping $prog:"
        killproc $prog -TERM
        RETVAL=$?
        [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/$prog
        echo
}




# SCRIPT

case $1 in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart)
                stop
                start
                ;;
        *)
                echo "usage: proxsmptd.sh {start|stop|restart}" >&2
                ;;
esac
