Subject: [spambayes-dev] Running Spambayes POP3 Proxy as a daemon
From: "Dave Handley"
Date: Sat, 11 Oct 2003 13:32:26 +0100
I've just started using Spambayes and because I'm an Outlook Express user, I was forced to use the route of setting up a POP3 proxy. I decided to do this on my Linux box (running Redhat Linux), but found the lack of a daemon to run a little frustrating. Overall setting up sb_server.py was quick and easy and it seems to be working well, but I ended up writing my own script to run the system as a daemon. I'm happy to submit this for possible inclusion in the source package. The script isn't perfect and I'm sure it can be improved. It is based on the dhcpd script and as such is GPL'd. Installation notes are:
-
The script should go in /etc/rc.d/init.d/
-
The standard start/stop links should be put in the appropriate runlevel (in my case runlevel 5)
-
The script requires that /etc/spamd/ is created - this will be where the data files are stored. It may make sense in future versions of sb_server.py to allow the configuration of the run directory.
-
Usage is /etc/rc.d/init.d/spamd start|stop|restart|status
Dave Handley
#!/bin/sh
#
# spamd This shell script takes care of starting and stopping
# the spambayes deamon.
#
# Author: Dave Handley
# Date: 11 Oct 03
#
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
RETVAL=0
# See how we were called.
case "$1" in
start)
# Start daemons.
echo -n "Starting spamd: "
cd /etc/spamd/
daemon /usr/local/bin/sb_server.py &
RETVAL=$?
echo
;;
stop)
# Stop daemons.
echo -n "Shutting down spamd: "
killproc sb_server.py
RETVAL=$?
echo
;;
restart|reload)
$0 stop
$0 start
RETVAL=$?
;;
status)
status sb_server.py
RETVAL=$?
;;
*)
echo "Usage: spamd {start|stop|restart|status}"
exit 1
esac
exit $RETVAL
February 19, 2005 Mike Blonder
If the script is to be installed on a Linux workstation running SuSE's 9.1 Distribution, the following modifications to the above need to be followed:
o The script should go into /etc/init.d o Source Function Library is '. /etc/rc.status' o Source Networking Configuration is '. /etc/networks o 'Daemon' is not a recognized command. Use 'startproc' instead
