Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 May 2007 20:15:18 +0400
From:      Alex Kapranoff <kappa@rambler-co.ru>
To:        freebsd-ports@freebsd.org
Subject:   Multiword "command" var in rc.d/*.sh script
Message-ID:  <20070528161518.GA37548@capella.park.rambler.ru>

next in thread | raw e-mail | index | archive | help
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"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070528161518.GA37548>