#!/sbin/sh
#
#
# Copyright (c) 2003-2004 eleven GmbH
# All rights reserved.
#
# /etc/init.d/eXpurgate
#
# To install this startup script:
# Copy this script to /etc/init.d/eXpurgate
# Link to rc3.d with: ln -s /etc/init.d/eXpurgate /etc/rc3.d/S40eXpurgate
#

EXPURGATE_BIN=/usr/local/eleven/bin/expurgate

# eXpurgate Options
#   -s will be added automaticly
#   Add for standard syslog logging: -L MAIL.NOTICE-NOTICE
#   For more optione use $EXPURGATE_BIN -h

EXPURGATE_OPTS="-f /usr/local/eleven/etc/expurgate.xml -p 11011 -o 10024 -F WARNING-EMERG:/tmp/expurgate.log"

case $1 in
'start')

        if ( [ -x "$EXPURGATE_BIN" ] ) then
            if ( $EXPURGATE_BIN $EXPURGATE_OPTS -s ) then
              echo eXpurgate started.
            fi
        else
            echo "eXpurgate binary '$EXPURGATE_BIN' does not exist."
        fi
        ;;
'stop')
        /usr/bin/pkill -u 0 -x expurgate

        ;;

'restart')
        /usr/bin/pkill -u 0 -x expurgate
        [ -x $EXPURGATE_BIN ] && $EXPURGATE_BIN $EXPURGATE_OPTS -s
        ;;
*)
        echo "Usage: $0 { start | stop | restart}"
        exit 1
        ;;
esac    
