From owner-freebsd-ports@FreeBSD.ORG Mon May 28 16:34:17 2007 Return-Path: X-Original-To: freebsd-ports@freebsd.org Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0BD2616A46C for ; Mon, 28 May 2007 16:34:17 +0000 (UTC) (envelope-from kappa@rambler-co.ru) Received: from relay0.rambler.ru (relay0.rambler.ru [81.19.66.187]) by mx1.freebsd.org (Postfix) with ESMTP id B91E613C48C for ; Mon, 28 May 2007 16:34:16 +0000 (UTC) (envelope-from kappa@rambler-co.ru) Received: from relay0.rambler.ru (localhost [127.0.0.1]) by relay0.rambler.ru (Postfix) with ESMTP id 3B5535F05 for ; Mon, 28 May 2007 20:13:51 +0400 (MSD) Received: from capella.park.rambler.ru (capella.park.rambler.ru [81.19.65.30]) by relay0.rambler.ru (Postfix) with ESMTP id 18B535E92 for ; Mon, 28 May 2007 20:13:51 +0400 (MSD) Received: by capella.park.rambler.ru (Postfix, from userid 1001) id 9C6F548D7; Mon, 28 May 2007 20:15:18 +0400 (MSD) Date: Mon, 28 May 2007 20:15:18 +0400 From: Alex Kapranoff To: freebsd-ports@freebsd.org Message-ID: <20070528161518.GA37548@capella.park.rambler.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: FreeBSD 6.2-STABLE i386 Organization: Inner Mongolia User-Agent: Mutt/1.5.15 (2007-04-06) X-Virus-Scanned: No virus found Subject: Multiword "command" var in rc.d/*.sh script X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2007 16:34:17 -0000 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"