From owner-freebsd-ports@FreeBSD.ORG Tue Jun 9 21:17:01 2009 Return-Path: Delivered-To: ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B098510656AD for ; Tue, 9 Jun 2009 21:17:01 +0000 (UTC) (envelope-from rwmaillists@googlemail.com) Received: from mail-ew0-f212.google.com (mail-ew0-f212.google.com [209.85.219.212]) by mx1.freebsd.org (Postfix) with ESMTP id 0815E8FC1D for ; Tue, 9 Jun 2009 21:17:00 +0000 (UTC) (envelope-from rwmaillists@googlemail.com) Received: by ewy8 with SMTP id 8so291063ewy.43 for ; Tue, 09 Jun 2009 14:17:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type:content-transfer-encoding; bh=bdBqpxwhReTynmHuGNVcMB7T1pXkf4YRqC7kFHyfYjM=; b=SJU7WTUbYqB7A+0PbwRTjZrsrL2ag7kOGI6CMowIJNWIH12DIl1a3kTcAviF+tb/K1 0jbwdVLp3fh6QKqD7HecSKjRnvcKQHn5gnztK+BfOjxNimLZgF2lUgaflyqN9C4HrB0J pwUlRdrahUEqLmbrnZxHxynsPWPUvueaJ3a7A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; b=QyL/8qPGW9JAA/E8nAz1OHKBXw44rNS3C5AY9WJRxhX2oXXMp/IURwqcnhX/fOyc4S CxUtkglLtfFWXsrBUZZDA6rFcsuuTyWtvc39Dul+y6ck9Nc/egXpkrfpXhzX/yjTGphq h0tRmhbL106kDwBhpvYu2tkb4SikSV99IjrCA= Received: by 10.210.67.4 with SMTP id p4mr6347319eba.36.1244582220056; Tue, 09 Jun 2009 14:17:00 -0700 (PDT) Received: from gumby.homeunix.com (bb-87-81-140-128.ukonline.co.uk [87.81.140.128]) by mx.google.com with ESMTPS id 24sm43040eyx.23.2009.06.09.14.16.58 (version=SSLv3 cipher=RC4-MD5); Tue, 09 Jun 2009 14:16:59 -0700 (PDT) Date: Tue, 9 Jun 2009 22:16:56 +0100 From: RW To: ports@freebsd.org Message-ID: <20090609221656.752e9c8f@gumby.homeunix.com> In-Reply-To: <4A2EB864.1060006@FreeBSD.org> References: <17ca67550906091046t15dfa574i95e432a09e60d379@mail.gmail.com> <1d3ed48c0906091140t37fbdd4eq84a1153348db7a53@mail.gmail.com> <4A2EB864.1060006@FreeBSD.org> X-Mailer: Claws Mail 3.7.1 (GTK+ 2.16.2; i386-portbld-freebsd7.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Subject: Re: Port of "service" command 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: Tue, 09 Jun 2009 21:17:06 -0000 On Tue, 09 Jun 2009 12:30:44 -0700 Doug Barton wrote: > Kevin Downey wrote: > > I have a similar shell function I am rather fond of: > > > > rc(){ > > find /etc/rc.d/"$1" /usr/local/etc/rc.d/"$1" -exec sudo {} `echo > > "$*"|cut -f 2- -d \ ` \; > > } > > Wow, that's painful. :) The only reason you don't notice how painful > is because those two directories have only a few files. Much much more > efficient would be something like: > > rc () { > local script=$1 > shift > > if [ -x "/etc/rc.d/$script" ]; then > /etc/rc.d/$script $* > elif [ -x "/usr/local/etc/rc.d/$script" ]; then > /usr/local/etc/rc.d/$script $* > else > echo "$script does not exist in /etc/rc.d or" > echo "/usr/local/etc/rc.d" > return 1 > fi > } This kind of thing is already implemented by the sysutils/bsdadminscripts port.