You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Benjamin Adams <ba...@ambrosiasw.com> on 2006/04/06 20:09:55 UTC

auto start spamd if dead

I created a script to auto learn spam every hour, I want the script  
to auto start spamd if its not running.
Auto start line is:
ps -auxwww | grep spamd | grep -v grep >> /dev/null || '/usr/bin/ 
spamd -d --syslog=/var/log/spamd.log &'

Error I get when running and spamd is off is:
/usr/bin/learn_spam: line 7: /usr/bin/spamd -d --syslog=/var/log/ 
spamd.log &: No such file or directory

line look bad?

Other versions I tried:

ps -auxwww | grep spamd | grep -v grep >> /dev/null || 'spamd -d -- 
syslog=/var/log/spamd.log &'
ps -auxwww | grep spamd | grep -v grep >> /dev/null || './usr/bin/ 
spamd -d --syslog=/var/log/spamd.log &'

Thanks for any help
Ben

Re: auto start spamd if dead

Posted by Mike Jackson <mj...@barking-dog.net>.
>I created a script to auto learn spam every hour, I want the script  to 
>auto start spamd if its not running.
> Auto start line is:
> ps -auxwww | grep spamd | grep -v grep >> /dev/null || '/usr/bin/ 
> spamd -d --syslog=/var/log/spamd.log &'
>
> Error I get when running and spamd is off is:
> /usr/bin/learn_spam: line 7: /usr/bin/spamd -d --syslog=/var/log/ 
> spamd.log &: No such file or directory
>
> line look bad?
>
> Other versions I tried:
>
> ps -auxwww | grep spamd | grep -v grep >> /dev/null || 'spamd -d -- 
> syslog=/var/log/spamd.log &'
> ps -auxwww | grep spamd | grep -v grep >> /dev/null || './usr/bin/ 
> spamd -d --syslog=/var/log/spamd.log &'

Stop torturing yourself - just use monit:

http://www.tildeslash.com/monit/

It's insanely configurable and can monitor nearly anything, and stop/restart 
it if it's not responding. For instance, here's my entry from Monit's config 
file for SpamAssassin:

check process spamd with pidfile /tmp/spamd.pid
start program = "/etc/rc.d/init.d/spamassassin start"
stop  program = "/etc/rc.d/init.d/spamassassin stop"
if failed unixsocket /var/run/spamd.sock then restart

(I disabled network access to spamd, otherwise I'd be testing connecting via 
its port as well.)