Multiword "command" var in rc.d/*.sh script

Alex Kapranoff kappa at rambler-co.ru
Mon May 28 16:34:17 UTC 2007


Good day!

What is the best way to support multiword "command" var in rc.d scripts?
My current problem is with dns/maradns port which I'm upgrading to use
maradns stock daemonizer instead of "| logger &" hack.

I'd like to specify "command" var as "${prefix}/bin/duende ${prefix}/sbin/maradns"
where duende(8) is the daemonizer. When I do this and use the script
to start maradns I get these two errors:

=====
~/work/ports/maradns[0]# /usr/local/etc/rc.d/maradns.sh start
/usr/local/etc/rc.d/maradns.sh: WARNING: $command_interpreter /usr/local/sbin/maradns != ELF
[: /usr/local/bin/duende: unexpected operator
Starting maradns.
=====

This happens because _find_processes() function in /etc/rc.subr splits
${command} and thinks I'm searching for "/usr/local/bin/duende"
script run via "/usr/local/sbin/maradns" interpreter.

I cannot set "procname" var to "${prefix}/bin/duende" because there are
other services which will be started via duende.

And _find_processes() is designed to be able to match only first word
from command column of ps(1) output unless the daemon is run via
interpreter.

I implemented some setproctitle(2) hacks inside duende so that it
includes all the relevant information in the first word
("/usr/local/bin/duende_/usr/local/sbin/maradns") but I don't feel
it's ok to fix problems in rc.subr with such dirty tricks.

Thanks for your advices!

-- 
Alex Kapranoff,
$n=["1another7Perl213Just3hacker49"=~/\d|\D*/g];
$$n[0]={grep/\d/,@$n};print"@$n{1..4}\n"


More information about the freebsd-ports mailing list