SpamAssassin provides spam filtering through the use of content matching rules and network based tests. The network based tests can include DNSBL checks and checksum tests, such as Razor.
Daemontools is a collection of tools for managing Unix services. It provides a means of monitoring a service, starting and stopping it and logging any debug and/or error messages. Daemontools provides easy service installation and removal, easy first time service startup, reliable restarts, easy, reliable signalling, clean process state and OS portability.
First verify the daemontools "svscan" process is running and SpamAssassin is installed. I install SpamAssassin by RPM which installs the "spamd" binary in the "/usr/bin" directory and places the configuration files under "/etc/mail/spamassassin". Your install may have these in different places, please adjust accordingly.
Choose a location where you want the physical service directories. I usually use "/var/service". Any directory may be used as long as it is not "/service".
Create the service directory.
# mkdir -p -m 1755 /var/service/spamd
# mkdir -p -m 755 /var/service/spamd/log
Download the "run" scripts for spamd and its log.
# cd /var/service/spamd
# wget -c http://www.antagonism.org/scripts/spamd-run
# mv spamd-run run
# chmod 755 run
# cd log
# wget -c http://www.antagonism.org/scripts/log-run
# mv log-run run
# chmod 755 run
Warning, before using either of my "run" scripts, make sure you understand what the commands do. In the spamd "run" script, the options I have configured do the following:
These options and more are covered in the spamd man page. The "log" run script rotates the logs every 1MB, keeps the latest 20 logs and writes them to the "main" directory under the "log" directory.
(The below section is taken almost verbatim from the following page created by John Simpson. I felt that his description on what happens when you activate a service was the most clear and easy to understand, so why change a thing?)
Once the directories are set up, you need to make them start running. This is done by creating a symbolic link from /service/(whatever) to the physical directory where the service lives. The "svscan" program checks /service every five seconds, and when it sees a new directory (or symbolic link) there, it starts a "supervise" process for that directory. In addition, if the directory has the sticky bit set and a child directory called "log", it starts a "supervise" process for the "log" child directory and sets up a pipe between the two processes (so that the main process's logs end up being sent to the log process).
The "supervise" program works by running the "run" script inside of whatever directory it's watching. If that child process (either the "run" script itself, or whatever process it runs using "exec") stops, it starts it back up by running the "run" script again.
Once the directories are set up, you need to make them start running. This is done by creating a symbolic link from /service/(whatever) to the physical directory where the service lives. The "svscan" program checks /service every five seconds, and when it sees a new directory (or symbolic link) there, it starts a "supervise" process for that directory. In addition, if the directory has the sticky bit set and a child directory called "log", it starts a "supervise" process for the "log" child directory and sets up a pipe between the two processes (so that the main process's logs end up being sent to the log process.)
The "supervise" program works by running the "run" script inside of whatever directory it's watching. If that child process (either the "run" script itself, or whatever process it runs using "exec") stops, it starts it back up by running the "run" script again.
The following commands will create the symbolic links needed to start the SpamAssassin service.
# ln -s /var/service/spamd /service/
After running this command, wait ten seconds (to give it time to start) and then run the "svstat" command to see what's running:
# svstat /service/spamd /service/spamd/log
/service/spamd: up (pid 2486) 261659 seconds
/service/spamd/log: up (pid 2493) 261659 seconds
As long as the new services show "up" with a timer of more than one second, the services are running correctly. If the timer on a service is 0 or 1 second, then wait about five seconds and run the same command- it should now be higher than 1 second. If it's still 0 or 1, then that service is having a problem and you need to fix it. This page provides some steps to troubleshoot daemontools service installations.
|
||||||||||||||
|