Start Spamd on boot in Debian Sarge

digene

Verified User
Joined
Oct 13, 2005
Messages
9
Hello to all!
this is my first post! :)
I have a server in debian sarge with directadmin panel.

I had installed Spamassassin like here:
http://help.directadmin.com/item.php?id=36
all is ok. I start spamd with: /usr/bin/spamd -d -c -m 5
I test with some spam mail and the spamd mark them with ***SPAM***

My problem is that when I reboot the server I have to manually launch spamd with: /usr/bin/spamd -d -c -m 5
There is not a script that start on boot spamd for debian sarge??

I read the other post.. but I don't find an answer..

Thanks! digene :)
 
Place this in your /etc/init.d/

create a file spamassassin with the following content:



#!/bin/sh

case "$1" in
'start')
/usr/bin/spamd -d -c -m 5
;;
'stop')
;;
*)
echo "Usage: $0 { start | stop }"
;;
esac
exit 0
 
spamd is typically launched from the exim startup script. The spam.sh script should enable this... it's the last few lines in the script and essentially just removes the comment character from exim's startup script. If that doesn't work under debian, I would send it to John as a bug.
 
@jerry2005
Thanks!! I will edit and use your script..

@ballyn
I pick the spam.sh with nano and I read it. Yes.. you have reason!
I think it is a really bug because in debian spamd don't start with exim like in spam.sh script!

The last line of spam.sh script is:

## we need to change how it's started.
if [ -e /etc/init.d/exim ]; then
$PERL -pi -e 's#/usr/bin/spamd -d -a -c -m 5#/usr/bin/spamd -d -c -m 5#' /etc/init.d/exim
fi
if [ -e /usr/local/etc/rc.d/exim ]; then
$PERL -pi -e 's#/usr/bin/spamd -d -a -c -m 5#/usr/bin/spamd -d -c -m 5#' /usr/local/etc/rc.d/exim
fi

exit 0;

But in my Debian Sarge:
- In "etc/init.d/exim" there aren't code lines for spamd!
- And doesn't exist the path "usr/local/etc/rc.d/"

I think is for this reason that spamd don't start in auto on boot!
I find a bug?? :confused:

digene :)
 
Last edited:
@jerry2005
I copy your script:

#!/bin/sh

case "$1" in
'start')
/usr/bin/spamd -d -c -m 5
;;
'stop')
;;
*)
echo "Usage: $0 { start | stop }"
;;
esac
exit 0

but it doesn't work!
when I execute the script debian say to me

: bad interpreter: No such file or directory..

Why?
 
Yes! I think there are!
because if I launch manually /usr/bin/spamd -d -c -m 5 it work!
 
Perhaps the layout is not correct try this:


#!/bin/sh

case "$1" in
'start')
/usr/bin/spamd -d -c -m 5
;;
'stop')
;;
*)
echo "Usage: $0 { start | stop }"
;;
esac
exit 0


Or else i dont know why its not working....
 
Finally I resolved! :D

First you have to install spamassassin like here:
http://help.directadmin.com/item.php?id=36

After, for start spamd at boot in debian sarge just make this simple script (thanks also to jerry2005) in /etc/init.d with name "spamd", permission "755", user and group "root":

Code:
#!/bin/sh
#
# This script starts and stops the Spamd daemon of Spamassassin
#

case "$1" in
'start')
/usr/bin/spamd -d -c -m 5
echo "Spamd is Started"
;;
'stop')
;;
*)
echo "Usage: $0 { start | stop }"
;;
esac
exit 0

after this make a "link" to the script just maked in "/etc/rc3.d/" e in "/etc/rc5.d" with name "S99spamd", permission 755, user and group "root"..

Hope I help some other debian user!

digene :D
 
On Debian I think it's cleaner to use start-stop-daemon. I made this initscript for spamd on Debian:

#!/bin/sh

PATH="$PATH:/usr/bin"
PID=/var/run/spamd.pid
BINARY=/usr/bin/spamd

case "$1" in
start)
echo -n "Starting Spamd: "
start-stop-daemon --start --exec $BINARY -- -c -d -m 5
echo
;;
stop)
echo -n "Stopping Spamd: "
start-stop-daemon --stop --name spamd
;;
restart)
$0 stop
$0 start
;;
*)
echo -n "Usage: $0 {start|stop|restart"
exit 1
esac
exit 0

HTH.
Ruben.
 
Debian SpamAssassin autostart SOLVED

The solution is so much easier:

edit the file /etc/default/spamassassin and change the line

ENABLED=0

to

ENABLED=1

That should do the trick :)
 
I have a simular problem. How can I autostart spamd when exim is rebooted? Now everytime the exim process is restarted I have to manualy run the spamd command. This is ofcourse verry enoying if you forget it once and recieve those damn spammails
 
Back
Top