#!/bin/sh
######################################################################
# Version:                                              September 1999
# Author:                                   Horms <horms@vergenet.net>
#
# Debian init script for perdition
# based on /etc/init.d/skeleton
#
# perdition
# Mail retrieval proxy server
# Copyright (C) 1999  Horms
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307  USA
#
######################################################################


PATH=/usr/sbin:/bin:/usr/bin:/sbin:/usr/sbin
NAME=perdition

# Run perdition listening as a POP3 proxy [yes|no]
POP3=yes
# Run perdition listening as an IMAP4 proxy [yes|no]
IMAP4=yes
# Additional runtime flags
FLAGS=

test -f $DAEMON || exit 0

case "$1" in
  start)
    if [ "$POP3" = "yes" ]; then 	
      start-stop-daemon --start --verbose --name perdition.pop3 \
        --exec /usr/sbin/perdition.pop3 -- $FLAGS
    fi
    if [ "$IMAP4" = "yes" ]; then 	
      start-stop-daemon --start --verbose --name perdition.imap4 \
        --exec /usr/sbin/perdition.imap4 -- $FLAGS
    fi
    ;;
  stop)
    if [ "$POP3" = "yes" ]; then 	
      start-stop-daemon --stop --verbose --name perdition.pop3 \
        --exec /usr/sbin/perdition.pop3
    fi
    if [ "$IMAP4" = "yes" ]; then 	
      start-stop-daemon --stop --verbose --name perdition.imap4 \
        --exec /usr/sbin/perdition.imap4
    fi
    ;;
  restart)
    $0 stop 
    $0 start 
    ;;
  force-reload|reload)
    # echo "Reloading $NAME configuration files"
    # start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
    ;;
  *)
    # echo "Usage: /etc/init.d/$NAME {start|stop|reload}"
    echo "Usage: /etc/init.d/$NAME {start|stop}"
    exit 1
    ;;
esac

exit 0
