Linux:

echo -n "Stopping spam daemon. (spamd)"
killproc spamd
if [ $? -eq 0 ] ; then
        echo "  done"
else
        echo "  failed"
fi

More generic:

pid=`ps ax | grep "spamd" | grep -v grep | awk '{print $1}'`
if [ "X$pid" != "X" ]; then
        echo "spamd is not running"
else
        kill -TERM $pid
fi

Several processes without using killall,
one process at a time

pids=`ps ax | grep "spamass\-milter" | \
grep -v grep | awk '{print $1}' | sort -nr | tr '\n' ' '`
pids=${pids% }
if [ "X${pids}" != "X" ]; then
  for pid in $pids
  do
      kill -TERM $pid
  done
else
      echo "mail-filter is not running"
fi

You'd want to spruce it up a bit.

"Ian R. Justman" wrote:
> 
> On Tue, 2002-02-26 at 20:51, Mike Loiterman wrote:
> > But the problem I'm encountering is that the process is called
> > /usr/bin/perl /usr/local/sbin/spamd.  The killall command is not
> > accepting any of the derivatives of that line I give it.  For example,
> > killall spamd, killall /usr/local/sbin/spamd, and killall /usr/bin/perl
> > /usr/local/sbin/spamd all won't work...it says it can't find any
> > matching processes.  I'v tried many different combinations with no luck.
> > This shouldn't be that hard I don't know why I'm having such difficulty.
> 
> Killall tends to work best with machine-native programs.
> 
> Since spamd is a Perl script, it cannot be killalled (well, technically
> yes you could but you'd have to do a killall perl which may not be
> necessarily what you want to do, depending on what your machine does).
> You basically have to know the pid of the Perl process running the
> script and kill THAT process.  To do so,as one person has already
> suggested, the best thing to do would be to add some code to spamd (or
> in my case, spamproxyd) to write a pid file in somewhere like /var/run
> so then you have easy access to send the parent Perl interpreter process
> the desired signal.
> 
> --Ian.
> 
> _______________________________________________
> Spamassassin-talk mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to