Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > d16675692219c3ec9e04fa6722b2e301 > files > 5

dspam-3.9.0-9.fc14.x86_64.rpm

#!/bin/sh
#
# dspam:        Starts DSPAM in daemon mode
#
# Written by Stevan Bajic <stevan@bajic.ch>.
#
# chkconfig:    - 40 80
# description:  DSPAM (De-Spam) is a scalable, open-source statistical
#               anti-spam filter that provides high levels of accuracy with minimal
#               resources.
# processname:  dspam
# pidfile:      /var/run/dspam/dspam.pid


# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Source config
if [ -f /etc/sysconfig/dspam ] ; then
    . /etc/sysconfig/dspam
else
    DSPAM_BIN="/usr/bin/dspam"
fi

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

RETVAL=0
prog="dspam"

start() {
    echo -n $"Starting $prog: "
    if [ -f /var/lock/subsys/dspam ]; then
        RETVAL=0
    else
        ${DSPAM_BIN} --daemon  2>/dev/null&
        RETVAL=$?
        if [ $RETVAL -eq 0 ]; then
            echo_success
        else
            echo_failure
        fi
    fi
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dspam
    return $RETVAL
}

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

reload() {
    echo -n $"Reloading $prog configuration: "
    killproc dspam -HUP
    RETVAL=$?
    echo
    return $RETVAL
}

# See how we were called.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status $prog
        ;;
    reload)
        reload
        ;;
    restart)
        stop
        start
        ;;
    condrestart)
        [ -f /var/lock/subsys/dspam ] && stop && start || :
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
        ;;
    esac
exit $RETVAL