rc.subr in 6.2 RELEASE

Mike Makonnen mtm at FreeBSD.Org
Fri Mar 23 10:19:58 UTC 2007


On Tue, Feb 27, 2007 at 03:38:24PM +0200, Alexander Shikoff wrote:
> Hello,
> 
> I guess my issue is more related to this mailing list rather than to 
> SpamAssassin one.
> 
> I use SpamAssassin built from ports tree on 6.2-RELEASE box.
> When debug is enabled via adding --debug flag to spamd_flags in rc.conf
> then rcNG script does not stop process:
> 
> # /usr/local/etc/rc.d/sa-spamd stop
> spamd not running? (check /var/run/spamd/spamd.pid).
> 
> But:
> # cat /var/run/spamd/spamd.pid 
> 98080
> # ps axww|grep spamd
> 98080  ??  Ss     0:02,24 /usr/local/bin/perl5.8.8 -T -w /usr/local/bin/spamd --siteconfigpath=/usr/local/etc/mail/spamassassin -x -d -l --max-conn-per-child=128 --timeout-tcp=10 --timeout-child=300 --pidfile=/var/run/spamd/spamd.pid --syslog=local0 --username=spamd --groupname=spamd --allowed-ips=127.0.0.0/8 --listen-ip=127.0.0.1 --debug=received-header,bayes -d -r /var/run/spamd/spamd.pid
> 
> If --debug flag is disabled then output of ps axww turned into:
> # ps axww|grep spamd
>  8483  ??  Ss     0:00,50 /usr/local/bin/spamd --siteconfigpath=/usr/local/etc/mail/spamassassin -x -d -l --max-conn-per-child=128 --timeout-tcp=10 --timeout-child=300 --pidfile=/var/run/spamd/spamd.pid --syslog=local0 --username=spamd --groupname=spamd --allowed-ips=127.0.0.0/8 --listen-ip=127.0.0.1 -d -r /var/run/spamd/spamd.pid (perl5.8.8)
> 
> and rcNG script works perfectly.
> 
> My question: is there a way to make rcNG script work in first case?
> Thanks.

I don't know if you solved the problem already, but here's why it doesn't work
when the debug flag is enabled:

Note the output of ps(1) in both cases:
  without debug flag: /usr/local/bin/spamd ...
  with debug flag   : /usr/local/bin/perl5.8.8 -T -w /usr/local/bin/spamd ..

When debugging is enabled spamd is run as an interpreted program, which
means that _find_processes() in rc.subr(8) will not find it because it
is NOT looking for an interpreted program.

I would suggest enabling debuging with an rc.conf knob and then doing
something like the following in the rc script:

if checkyesno spamd_debug_enable; then
	command_interpreter=/usr/local/bin/perl
	spamd_flags="${spamd_flags} --debug"
fi

Cheers.
-- 
Mike Makonnen       | GPG-KEY: http://people.freebsd.org/~mtm/mtm.asc
mmakonnen at gmail.com | AC7B 5672 2D11 F4D0 EBF8  5279 5359 2B82 7CD4 1F55
mtm at FreeBSD.Org     | FreeBSD - Unleash the Daemon !


More information about the freebsd-rc mailing list