View Full Version : Start Spamd on boot in Debian Sarge
digene
10-13-2005, 10:56 AM
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 :)
jerry2005
10-14-2005, 06:33 AM
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
ballyn
10-14-2005, 06:43 AM
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.
digene
10-14-2005, 07:43 AM
@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 :)
digene
10-14-2005, 08:28 AM
@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?
jerry2005
10-14-2005, 08:33 AM
Are all the mentioned files in place ?
/bin/sh
/usr/bin/spamd
digene
10-14-2005, 08:37 AM
Yes! I think there are!
because if I launch manually /usr/bin/spamd -d -c -m 5 it work!
jerry2005
10-14-2005, 08:56 AM
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....
digene
10-14-2005, 10:56 AM
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":
#!/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
Redevelopment
04-16-2006, 04:22 AM
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.
klaver
01-08-2007, 04:24 AM
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 :)
DaMick
01-08-2007, 08:07 AM
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
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.