[Spambayes] sb_server.py as a daemon

Laurent François lau.francois at worldonline.fr
Mon Oct 8 22:42:46 CEST 2007


Hello,

I am trying to us sb_server.py as a daemon.
I am using the script from Fernando Nino:
########################
#!/bin/bash
#
# spambayes:    Starts the spam filter as a pop3 proxy
#
# Version:      @(#) /etc/init.d/spambayes 1.0
#
# chkconfig: - 95 21
# description: This shell script takes care of starting and stopping \
#              spambayes pop3 proxy
# processname: sb_server.py
#


SBPROXY=/usr/bin/sb_server.py
SBLOG=/var/log/spam.log
SBDIR=/var/mail/vhosts/.spambayes/hammiedb

[ -x $SBPROXY ] || exit 0

# Source function library.
# Change by myself

##. /etc/init.d/functions

. /lib/lsb/init-functions

RETVAL=0

start () {
    date >> $SBLOG
    echo -n "Starting SpamBayes POP3 proxy: "
    if [ ! -d $SBDIR ] ; then
      echo "Repertoire $SBDIR non present" >> $SBLOG
      RETVAL=1
    else
      cd $SBDIR
      ($SBPROXY 2>&1 >> $SBLOG) &
      RETVAL=$?
    fi
    action "" [ $RETVAL = 0 ]
    return $RETVAL
}

stop () {
    # stop daemon
    date >> $SBLOG
    echo -n "Stopping SpamBayes POP3 proxy: "
    killproc $SBPROXY 1
    RETVAL=$?
    echo
      [ $RETVAL = 0 ]
    return $RETVAL
}

restart () {
    stop
    start
    RETVAL=$?
    return $RETVAL
}

# See how we were called.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status $SBPROXY
        RETVAL=$?
        ;;
    restart)
        restart
        ;;
    *)
        echo "Usage: $0 {start|stop|restart|status}"
        RETVAL=1
esac
############################

and when I run it I got this error message:
./spambayes start
Starting SpamBayes POP3 proxy: ./spambayes: line 36: action: command not 
found

Any idea ?

Bye






More information about the SpamBayes mailing list